Skip to content

Commit fa60ee0

Browse files
authored
Merge pull request autotest#6751 from yanglei-rh/LIBVIRTAT-22234
Improve hotunplug_nic_with_operation..with_reboot
2 parents 7881c71 + cc49c21 commit fa60ee0

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

libvirt/tests/src/virtual_network/qemu/hotunplug_nic_with_operation.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
# Author: Transferred from tp-qemu nic_hotplug test case
77
#
88
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9+
from virttest import remote
910
from virttest import virsh
11+
from virttest import virt_vm
1012
from virttest import utils_misc
1113
from virttest import utils_net
1214

@@ -38,7 +40,20 @@ def run_sub_test(test, vm, params, plug_tag):
3840
if sub_type == "reboot":
3941
test.log.info("Running sub test '%s' %s", sub_type, plug_tag)
4042
if params.get("reboot_method"):
41-
vm.reboot(session, params["reboot_method"], 0, login_timeout, serial=True)
43+
# TODO: This is a workaround and will be removed when the framework supports this feature
44+
try:
45+
vm.reboot(session, params["reboot_method"], 0, login_timeout, serial=True)
46+
except virt_vm.VMRebootError as e:
47+
if "Guest refuses to go down" in str(e):
48+
test.log.warning("Reboot detection failed, attempting to verify reboot completion")
49+
try:
50+
verify_session = vm.wait_for_serial_login(timeout=login_timeout)
51+
verify_session.close()
52+
test.log.info("Reboot completed successfully")
53+
except (remote.LoginError, remote.LoginTimeoutError):
54+
test.fail("Reboot failed, VM cannot be connected")
55+
else:
56+
raise
4257
elif sub_type == "shutdown":
4358
test.log.info("Running sub test '%s' %s", sub_type, plug_tag)
4459
if shutdown_method == "shell":

0 commit comments

Comments
 (0)