Skip to contentSkip to conversation

KVM test: remote_login(): if rss.exe says "Please wait", wait

PATCH New Michael Goldish 1 participant 5 messages Mar 23, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 KVM test: remote_login(): if rss.exe says "Please wait", wait

Recognize rss.exe's "Please wait" message and give the login procedure more time to complete. The message is sent before spawning cmd.exe, which may take some time under heavy load.

---
 client/tests/kvm/kvm_utils.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
client/tests/kvm/kvm_utils.py +7 -2
index 5834539..8531c79 100644
@@ -482,7 +482,8 @@ def remote_login(command, password, prompt, linesep="\n", timeout=10):
     while True:
         (match, text) = sub.read_until_last_line_matches(
                 [r"[Aa]re you sure", r"[Pp]assword:\s*$", r"^\s*[Ll]ogin:\s*$",
-                 r"[Cc]onnection.*closed", r"[Cc]onnection.*refused", prompt],
+                 r"[Cc]onnection.*closed", r"[Cc]onnection.*refused",
+                 r"[Pp]lease wait", prompt],
                  timeout=timeout, internal_timeout=0.5)
         if match == 0:  # "Are you sure you want to continue connecting"
             logging.debug("Got 'Are you sure...'; sending 'yes'")
@@ -510,7 +511,11 @@ def remote_login(command, password, prompt, linesep="\n", timeout=10):
             logging.debug("Got 'Connection refused'")
             sub.close()
             return None
-        elif match == 5:  # prompt
+        elif match == 5:  # "Please wait"
+            logging.debug("Got 'Please wait'")
+            timeout = 30
+            continue
+        elif match == 6:  # prompt
             logging.debug("Got shell prompt -- logged in")
             return sub
         else:  # match == None
Signature · 1 line
1.5.4.1
#1 lore raw

PATCH 2/5 KVM test: tests_base.cfg.sample: add /f option to all Windows shutdown commands

It seems that when Windows is locked it refuses to shutdown unless given the /f option.

- Add /f to all Windows shutdown and reboot commands.
- Remove duplicate shutdown and reboot commands for Win2003, Win2008 and Win7.

---
 client/tests/kvm/tests_base.cfg.sample |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
client/tests/kvm/tests_base.cfg.sample +2 -8
index 2a36687..bacbcee 100644
@@ -687,8 +687,8 @@ variants:
     # Windows section
     - @Windows:
         no autotest linux_s3 vlan_tag
-        shutdown_command = shutdown /s /t 0
-        reboot_command = shutdown /r /t 0
+        shutdown_command = shutdown /s /f /t 0
+        reboot_command = shutdown /r /f /t 0
         status_test_command = echo %errorlevel%
         shell_prompt = "^\w:\\.*>\s*$"
         username = Administrator
@@ -808,8 +808,6 @@ variants:
             - Win2003:
                 image_name = win2003
                 image_size = 20G
-                shutdown_command = shutdown /s /f /t 0
-                reboot_command = shutdown /r /f /t 0
 
                 variants:
                     - 32:
@@ -908,8 +906,6 @@ variants:
             - Win2008:
                 image_name = win2008
                 image_size = 20G
-                shutdown_command = shutdown /s /f /t 0
-                reboot_command = shutdown /r /f /t 0
 
                 variants:
                     - 32sp1:
@@ -985,8 +981,6 @@ variants:
             - Win7:
                 image_name = win7
                 image_size = 20G
-                shutdown_command = shutdown /s /f /t 0
-                reboot_command = shutdown /r /f /t 0
 
                 variants:
                     - 32:
Signature · 1 line
1.5.4.1
#2 lore raw

PATCH 3/5 KVM test: timedrift: first open ssh/rss sessions with the guest, then start load

Currently, for each guest "load session", a login is performed, followed immediately by sending the command that initiates the load. When the second login is attempted, the guest is already loaded by the first session, and therefore may respond slowly to the login request.
This patch makes the test open all load sessions first, and then send the load command to all open sessions.

---
 client/tests/kvm/tests/timedrift.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
client/tests/kvm/tests/timedrift.py +2 -1
index b3e8770..194f09c 100644
@@ -98,8 +98,9 @@ def run_timedrift(test, params, env):
                     raise error.TestFail("Could not log into guest")
                 load_session.set_output_prefix("(guest load %d) " % i)
                 load_session.set_output_func(logging.debug)
-                load_session.sendline(guest_load_command)
                 guest_load_sessions.append(load_session)
+            for load_session in guest_load_sessions:
+                load_session.sendline(guest_load_command)
 
             # Run some load on the host
             logging.info("Starting load on host...")
Signature · 1 line
1.5.4.1
#3 lore raw

PATCH 4/5 KVM test: stress_boot: make boot timeout controllable

Use parameter 'boot_timeout'. Defaults to 240.

---
 client/tests/kvm/tests/stress_boot.py  |    9 +++++----
 client/tests/kvm/tests_base.cfg.sample |    1 +
 2 files changed, 6 insertions(+), 4 deletions(-)
client/tests/kvm/tests/stress_boot.py +5 -4
index 0b5ec02..24a005c 100644
@@ -21,7 +21,8 @@ def run_stress_boot(tests, params, env):
 
     logging.info("Waiting for first guest to be up...")
 
-    session = kvm_utils.wait_for(vm.remote_login, 240, 0, 2)
+    boot_timeout = float(params.get("boot_timeout", 240))
+    session = kvm_utils.wait_for(vm.remote_login, boot_timeout, 0, 2)
     if not session:
         raise error.TestFail("Could not log into first guest")
 
@@ -32,9 +33,8 @@ def run_stress_boot(tests, params, env):
     # boot the VMs
     while num <= int(params.get("max_vms")):
         try:
-            vm_name = "vm" + str(num)
-
             # clone vm according to the first one
+            vm_name = "vm" + str(num)
             vm_params = vm.get_params().copy()
             vm_params["address_index"] = str(address_index)
             curr_vm = vm.clone(vm_name, vm_params)
@@ -43,7 +43,8 @@ def run_stress_boot(tests, params, env):
             kvm_preprocessing.preprocess_vm(tests, vm_params, env, vm_name)
             params['vms'] += " " + vm_name
 
-            curr_vm_session = kvm_utils.wait_for(curr_vm.remote_login, 240, 0, 2)
+            curr_vm_session = kvm_utils.wait_for(curr_vm.remote_login,
+                                                 boot_timeout, 0, 2)
             if not curr_vm_session:
                 raise error.TestFail("Could not log into guest #%d" % num)
 
client/tests/kvm/tests_base.cfg.sample +1 -0
index bacbcee..249f1b4 100644
@@ -179,6 +179,7 @@ variants:
         max_vms = 5    
         alive_test_cmd = uname -a
         clone_address_index_base = 10
+        boot_timeout = 240
         kill_vm = yes
         kill_vm_vm1 = no
         kill_vm_gracefully = no
Signature · 1 line
1.5.4.1
#4 lore raw

PATCH 5/5 KVM test: abort-on-error mode

If 'abort_on_error' is set to 'yes' for a test, the entire job will be aborted when that test fails. If the parameter is set for all tests, the job will be aborted as soon as the first test fails. Before aborting, the filename of the monitor unix socket of each VM will be printed, as well as the command line used to start that VM.

Currently this is only supported in serial exceution mode. Behavior in parallel mode is undefined.

To enable abort-on-error, and to prevent the postprocessor from killing any VMs, set the following options:

abort_on_error = yes
kill_vm.* ?= no
kill_unresponsive_vms.* ?= no

These options appear commented out near the end of tests.cfg.sample.

They can also be set for specific tests, either by writing an exception like

WinXP.32\b.*\bmigrate:
abort_on_error = yes
...

in tests.cfg, or by setting the parameters in the test variant itself (somewhere in tests_base.cfg).

---
 client/tests/kvm/kvm_preprocessing.py |   13 +++++++++++++
 client/tests/kvm/tests.cfg.sample     |    5 +++++
 2 files changed, 18 insertions(+), 0 deletions(-)
client/tests/kvm/kvm_preprocessing.py +13 -0
index b3fef9d..50db65c 100644
@@ -347,6 +347,19 @@ def postprocess(test, params, env):
                         int(params.get("post_command_timeout", "600")),
                         params.get("post_command_noncritical") == "yes")
 
+    # Abort on error?
+    if params.get("abort") == "yes":
+        exc_string = str(sys.exc_info()[1])
+        logging.info("Aborting job (%s)", exc_string)
+        for vm in kvm_utils.env_get_all_vms(env):
+            if not vm.is_dead():
+                logging.info("VM '%s' is alive.", vm.name)
+                logging.info("The monitor unix socket of '%s' is: %s",
+                             vm.name, vm.monitor_file_name)
+                logging.info("The command line used to start '%s' was:\n%s",
+                             vm.name, vm.make_qemu_command())
+        raise error.JobError("Abort requested (%s)" % exc_string)
+
 
 def postprocess_on_error(test, params, env):
     """
client/tests/kvm/tests.cfg.sample +5 -0
index b86b6c4..2c17454 100644
@@ -74,5 +74,10 @@ variants:
         only Fedora.12.64
         only unattended_install boot shutdown
 
+# Uncomment the following lines to enable abort-on-error mode:
+#abort_on_error = yes
+#kill_vm.* ?= no
+#kill_unresponsive_vms.* ?= no
+
 # Choose your test list from the testsets defined
 only qemu_kvm_f12_quick
Signature · 1 line
1.5.4.1