OLD | NEW |
1 import logging, time | 1 import logging, time |
2 from autotest_lib.client.common_lib import error | 2 from autotest_lib.client.common_lib import error |
3 import kvm_subprocess, kvm_test_utils, kvm_utils | 3 from autotest_lib.client.virt import virt_utils |
4 | 4 |
5 | 5 |
6 def run_shutdown(test, params, env): | 6 def run_shutdown(test, params, env): |
7 """ | 7 """ |
8 KVM shutdown test: | 8 KVM shutdown test: |
9 1) Log into a guest | 9 1) Log into a guest |
10 2) Send a shutdown command to the guest, or issue a system_powerdown | 10 2) Send a shutdown command to the guest, or issue a system_powerdown |
11 monitor command (depending on the value of shutdown_method) | 11 monitor command (depending on the value of shutdown_method) |
12 3) Wait until the guest is down | 12 3) Wait until the guest is down |
13 | 13 |
(...skipping 13 matching lines...) Expand all Loading... |
27 logging.info("Shutdown command sent; waiting for guest to go " | 27 logging.info("Shutdown command sent; waiting for guest to go " |
28 "down...") | 28 "down...") |
29 elif params.get("shutdown_method") == "system_powerdown": | 29 elif params.get("shutdown_method") == "system_powerdown": |
30 # Sleep for a while -- give the guest a chance to finish booting | 30 # Sleep for a while -- give the guest a chance to finish booting |
31 time.sleep(float(params.get("sleep_before_powerdown", 10))) | 31 time.sleep(float(params.get("sleep_before_powerdown", 10))) |
32 # Send a system_powerdown monitor command | 32 # Send a system_powerdown monitor command |
33 vm.monitor.cmd("system_powerdown") | 33 vm.monitor.cmd("system_powerdown") |
34 logging.info("system_powerdown monitor command sent; waiting for " | 34 logging.info("system_powerdown monitor command sent; waiting for " |
35 "guest to go down...") | 35 "guest to go down...") |
36 | 36 |
37 if not kvm_utils.wait_for(vm.is_dead, 240, 0, 1): | 37 if not virt_utils.wait_for(vm.is_dead, 240, 0, 1): |
38 raise error.TestFail("Guest refuses to go down") | 38 raise error.TestFail("Guest refuses to go down") |
39 | 39 |
40 logging.info("Guest is down") | 40 logging.info("Guest is down") |
41 | 41 |
42 finally: | 42 finally: |
43 session.close() | 43 session.close() |
OLD | NEW |