• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import time
2
3
4def run_boot(test, params, env):
5    """
6    KVM reboot test:
7    1) Log into a guest
8    2) Send a reboot command or a system_reset monitor command (optional)
9    3) Wait until the guest is up again
10    4) Log into the guest to verify it's up again
11
12    @param test: kvm test object
13    @param params: Dictionary with the test parameters
14    @param env: Dictionary with test environment.
15    """
16    vm = env.get_vm(params["main_vm"])
17    vm.verify_alive()
18    timeout = float(params.get("login_timeout", 240))
19    session = vm.wait_for_login(timeout=timeout)
20
21    if params.get("reboot_method"):
22        if params["reboot_method"] == "system_reset":
23            time.sleep(int(params.get("sleep_before_reset", 10)))
24        session = vm.reboot(session, params["reboot_method"], 0, timeout)
25
26    session.close()
27