diffstat output:
kvm_tests.cfg.sample | 1 +
kvm_tests.py | 39 +++++++++++++++++++++------------------
2 files changed, 22 insertions(+), 18 deletions(-)
Signed-off-by: Supriya Kannery <supriyak@in.ibm.com>
---
@@ -50,6 +50,7 @@ variants:
reboot = yes
extra_params += " -snapshot"
kill_vm_on_error = yes
+ reboot_iterations = 1
- migrate: install setup
type = migration
@@ -31,25 +31,28 @@ def run_boot(test, params, env):
kvm_log.info("Logged in")
if params.get("reboot") == "yes":
- session.sendline(params.get("cmd_reboot"))
- kvm_log.info("Reboot command sent; waiting for guest to go down...")
+ iteration = int(params.get("reboot_iterations",1))
+ while iteration:
+ session.sendline(params.get("cmd_reboot"))
+ kvm_log.info("Reboot command sent; waiting for guest to go down...")
+
+ if not kvm_utils.wait_for(lambda: not session.is_responsive(), 120, 0, 1):
+ message = "Guest refuses to go down"
+ kvm_log.error(message)
+ raise error.TestFail, message
+
+ session.close()
+
+ kvm_log.info("Guest is down; waiting for it to go up again...")
+
+ session = kvm_utils.wait_for(vm.ssh_login, 120, 0, 2)
+ if not session:
+ message = "Could not log into guest after reboot"
+ kvm_log.error(message)
+ raise error.TestFail, message
- if not kvm_utils.wait_for(lambda: not session.is_responsive(), 120, 0, 1):
- message = "Guest refuses to go down"
- kvm_log.error(message)
- raise error.TestFail, message
-
- session.close()
-
- kvm_log.info("Guest is down; waiting for it to go up again...")
-
- session = kvm_utils.wait_for(vm.ssh_login, 120, 0, 2)
- if not session:
- message = "Could not log into guest after reboot"
- kvm_log.error(message)
- raise error.TestFail, message
-
- kvm_log.info("Guest is up again")
+ kvm_log.info("Guest is up again")
+ iteration -= 1
session.close()