[PATCH] KVM test: Exposing boot and reboot timeouts in config files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some guests may take longer to boot/reboot in some hosts,
so let's expose the boot and reboot timeouts in the tests
config file. Also, print the timeouts on the debug
messages.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@xxxxxxxxxx>
---
 client/tests/kvm/kvm_test_utils.py     |   13 +++++++------
 client/tests/kvm/tests/boot.py         |   10 ++++++----
 client/tests/kvm/tests_base.cfg.sample |    2 ++
 3 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/client/tests/kvm/kvm_test_utils.py b/client/tests/kvm/kvm_test_utils.py
index 7d96d6e..564ff35 100644
--- a/client/tests/kvm/kvm_test_utils.py
+++ b/client/tests/kvm/kvm_test_utils.py
@@ -53,7 +53,7 @@ def wait_for_login(vm, nic_index=0, timeout=240, start=0, step=2):
     @param timeout: Time to wait before giving up.
     @return: A shell session object.
     """
-    logging.info("Trying to log into guest '%s'..." % vm.name)
+    logging.info("Trying to log into guest '%s', timeout %ds", vm.name, timeout)
     session = kvm_utils.wait_for(lambda: vm.remote_login(nic_index=nic_index),
                                  timeout, start, step)
     if not session:
@@ -80,16 +80,16 @@ def reboot(vm, session, method="shell", sleep_before_reset=10, nic_index=0,
     if method == "shell":
         # Send a reboot command to the guest's shell
         session.sendline(vm.get_params().get("reboot_command"))
-        logging.info("Reboot command sent; waiting for guest to go down...")
+        logging.info("Reboot command sent. Waiting for guest to go down")
     elif method == "system_reset":
         # Sleep for a while before sending the command
         time.sleep(sleep_before_reset)
         # Send a system_reset monitor command
         vm.send_monitor_cmd("system_reset")
-        logging.info("system_reset monitor command sent; waiting for guest to "
-                     "go down...")
+        logging.info("Monitor command system_reset sent. Waiting for guest to "
+                     "go down")
     else:
-        logging.error("Unknown reboot method: %s" % method)
+        logging.error("Unknown reboot method: %s", method)
 
     # Wait for the session to become unresponsive and close it
     if not kvm_utils.wait_for(lambda: not session.is_responsive(timeout=30),
@@ -98,7 +98,8 @@ def reboot(vm, session, method="shell", sleep_before_reset=10, nic_index=0,
     session.close()
 
     # Try logging into the guest until timeout expires
-    logging.info("Guest is down; waiting for it to go up again...")
+    logging.info("Guest is down. Waiting for it to go up again, timeout %ds",
+                 timeout)
     session = kvm_utils.wait_for(lambda: vm.remote_login(nic_index=nic_index),
                                  timeout, 0, 2)
     if not session:
diff --git a/client/tests/kvm/tests/boot.py b/client/tests/kvm/tests/boot.py
index cd1f1d4..9b3f392 100644
--- a/client/tests/kvm/tests/boot.py
+++ b/client/tests/kvm/tests/boot.py
@@ -16,7 +16,9 @@ def run_boot(test, params, env):
     @param env: Dictionary with test environment.
     """
     vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
-    session = kvm_test_utils.wait_for_login(vm)
+    session = kvm_test_utils.wait_for_login(vm, 0,
+                                         float(params.get("boot_timeout", 240)),
+                                         0, 2)
 
     try:
         if not params.get("reboot_method"):
@@ -24,9 +26,9 @@ def run_boot(test, params, env):
 
         # Reboot the VM
         session = kvm_test_utils.reboot(vm, session,
-                                        params.get("reboot_method"),
-                                        float(params.get("sleep_before_reset",
-                                                         10)))
+                                    params.get("reboot_method"),
+                                    float(params.get("sleep_before_reset", 10)),
+                                    0, float(params.get("reboot_timeout", 240)))
 
     finally:
         session.close()
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index 040d0c3..340b0c0 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -75,11 +75,13 @@ variants:
         type = boot
         restart_vm = yes
         kill_vm_on_error = yes
+        boot_timeout = 240
 
     - reboot:       install setup unattended_install
         type = boot
         reboot_method = shell
         kill_vm_on_error = yes
+        reboot_timeout = 240
 
     - migrate:      install setup unattended_install
         type = migration
-- 
1.6.6.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux