Skip to contentSkip to conversation

KVM test: Exposing boot and reboot timeouts in config files

PATCH In review Lucas Meneghel Rodrigues 2 participants 2 messages Mar 8, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM test: Exposing boot and reboot timeouts in config files

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.

---
 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(-)
client/tests/kvm/kvm_test_utils.py +7 -6
index 7d96d6e..564ff35 100644
@@ -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:
client/tests/kvm/tests/boot.py +6 -4
index cd1f1d4..9b3f392 100644
@@ -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()
client/tests/kvm/tests_base.cfg.sample +2 -0
index 040d0c3..340b0c0 100644
@@ -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
Signature · 1 line
1.6.6.1
#1 lore raw
Quoted 3 lines · Lucas Meneghel Rodrigues

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

Fine. It seems we missed it during the major development cycle. We faced this situation when we were having kvm_autotest git. The patch that I sent was merged. This patch makes perfect sense for cases like stress boot, slow machines, highly loaded machines etc.

Quoted 107 lines

messages.

---
 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(-)
client/tests/kvm/kvm_test_utils.py +0 -0
index 7d96d6e..564ff35 100644
@@ -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:

client/tests/kvm/kvm_test_utils.py +0 -0
@@ -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),

client/tests/kvm/kvm_test_utils.py +2 -1
@@ -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:

client/tests/kvm/tests/boot.py +0 -0
index cd1f1d4..9b3f392 100644
@@ -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"):

client/tests/kvm/tests/boot.py +3 -3
@@ -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()

client/tests/kvm/tests_base.cfg.sample +0 -0
index 040d0c3..340b0c0 100644
@@ -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

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Signature · 1 line
Sudhir Kumar