|
6 | 6 | # Author: Transferred from tp-qemu nic_hotplug test case |
7 | 7 | # |
8 | 8 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 9 | +from virttest import remote |
9 | 10 | from virttest import virsh |
| 11 | +from virttest import virt_vm |
10 | 12 | from virttest import utils_misc |
11 | 13 | from virttest import utils_net |
12 | 14 |
|
@@ -38,7 +40,20 @@ def run_sub_test(test, vm, params, plug_tag): |
38 | 40 | if sub_type == "reboot": |
39 | 41 | test.log.info("Running sub test '%s' %s", sub_type, plug_tag) |
40 | 42 | 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 |
42 | 57 | elif sub_type == "shutdown": |
43 | 58 | test.log.info("Running sub test '%s' %s", sub_type, plug_tag) |
44 | 59 | if shutdown_method == "shell": |
|
0 commit comments