Skip to contentSkip to conversation

KVM test: introduce a helper class to run a function in the background

PATCH New Michael Goldish 2 participants 37 messages Dec 27, 2010 – Dec 28, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/28 KVM test: introduce a helper class to run a function in the background

This class allows running a function in a background thread. If the function raises an exception, the exception is recorded and re-raised when join() is called. Otherwise, join() returns the value returned by the function.

This is useful for performing multiple simple actions in parallel (such as rebooting several VMs at once to save time). It may also be useful for running tests on a VM while migrating it (but then it wouldn't be safe to pass the VM object as a parameter to this class).

Differences from Jason Wang's original patch:
- Inherit from threading.Thread instead of wrapping it.
- Record the returned value as well as the exception raised.
- When re-raising the exception, use its original traceback so the user will know where the original exception was raised.
- Destroy all potentially circular references (self._args and the traceback in self._e can refer to the thread object itself).
- Rename BackgroundTest to Thread.

---
 client/tests/kvm/kvm_utils.py |   60 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 59 insertions(+), 1 deletions(-)
client/tests/kvm/kvm_utils.py +59 -1
index 5496e06..5d79112 100644
@@ -5,7 +5,7 @@ KVM test utility functions.
 """
 
 import time, string, random, socket, os, signal, re, logging, commands, cPickle
-import fcntl, shelve, ConfigParser, rss_file_transfer
+import fcntl, shelve, ConfigParser, rss_file_transfer, threading, sys
 from autotest_lib.client.bin import utils, os_dep
 from autotest_lib.client.common_lib import error, logging_config
 import kvm_subprocess
@@ -1044,6 +1044,64 @@ def get_vendor_from_pci_id(pci_id):
     return re.sub(":", " ", commands.getoutput(cmd))
 
 
+class Thread(threading.Thread):
+    """
+    Runs a test in the background thread.
+    """
+    def __init__(self, target, args=(), kwargs={}):
+        """
+        Initialize the instance.
+
+        @param target: Function to run in the thread.
+        @param args: Arguments to pass to target.
+        @param kwargs: Keyword arguments to pass to target.
+        """
+        threading.Thread.__init__(self)
+        self._target = target
+        self._args = args
+        self._kwargs = kwargs
+
+
+    def run(self):
+        """
+        Run target (passed to the constructor).  No point in calling this
+        function directly.  Call start() to make this function run in a new
+        thread.
+        """
+        self._e = None
+        self._retval = None
+        try:
+            try:
+                self._retval = self._target(*self._args, **self._kwargs)
+            except:
+                self._e = sys.exc_info()
+                raise
+        finally:
+            # Avoid circular references (start() may be called only once so
+            # it's OK to delete these)
+            del self._target, self._args, self._kwargs
+
+
+    def join(self, timeout=None):
+        """
+        Join the thread.  If target raised an exception, re-raise it.
+        Otherwise, return the value returned by target.
+
+        @param timeout: Timeout value to pass to threading.Thread.join().
+        """
+        threading.Thread.join(self, timeout)
+        try:
+            if self._e:
+                raise self._e[0], self._e[1], self._e[2]
+            else:
+                return self._retval
+        finally:
+            # Avoid circular references (join() may be called multiple times
+            # so we can't delete these)
+            self._e = None
+            self._retval = None
+
+
 class KvmLoggingConfig(logging_config.LoggingConfig):
     """
     Used with the sole purpose of providing convenient logging setup
Signature · 1 line
1.7.3.3
#1 lore raw

PATCH 2/28 KVM test: kvm_utils.py: add a convenience function to run functions in parallel

---
 client/tests/kvm/kvm_utils.py |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)
client/tests/kvm/kvm_utils.py +23 -1
index 5d79112..57c9951 100644
@@ -1046,7 +1046,7 @@ def get_vendor_from_pci_id(pci_id):
 
 class Thread(threading.Thread):
     """
-    Runs a test in the background thread.
+    Run a function in a background thread.
     """
     def __init__(self, target, args=(), kwargs={}):
         """
@@ -1102,6 +1102,28 @@ class Thread(threading.Thread):
             self._retval = None
 
 
+def parallel(targets):
+    """
+    Run multiple functions in parallel.
+    
+    @param targets: A sequence of tuples or functions.  If it's a sequence of
+            tuples, each tuple will be interpreted as (target, args, kwargs) or
+            (target, args) or (target,) depending on its length.  If it's a
+            sequence of functions, the functions will be called without
+            arguments.
+    @return: A list of the values returned by the functions called.
+    """
+    threads = []
+    for target in targets:
+        if isinstance(target, tuple) or isinstance(target, list):
+            t = Thread(*target)
+        else:
+            t = Thread(target)
+        threads.append(t)
+        t.start()
+    return [t.join() for t in threads]
+
+
 class KvmLoggingConfig(logging_config.LoggingConfig):
     """
     Used with the sole purpose of providing convenient logging setup
Signature · 1 line
1.7.3.3
#2 lore raw

PATCH 3/28 KVM test: corrections to migration_with_reboot

In reply to Michael Goldish

- Use wait_for() to try remote_login() multiple times before giving up.
- Take VM parameters from vm.params, not params.

---
 client/tests/kvm/tests/migration_with_reboot.py |   26 +++++++++++-----------
 1 files changed, 13 insertions(+), 13 deletions(-)
client/tests/kvm/tests/migration_with_reboot.py +13 -13
index 5673b45..5070dbc 100644
@@ -24,7 +24,7 @@ def run_migration_with_reboot(test, params, env):
                     password, prompt, linesep, log_filename, timeout):
         """
         A version of reboot test which is safe to be called in the background as
-        it only needs an vm object
+        it doesn't need a VM object.
         """
         # Send a reboot command to the guest's shell
         session.sendline(reboot_command)
@@ -37,12 +37,12 @@ def run_migration_with_reboot(test, params, env):
         session.close()
 
         # Try logging into the guest until timeout expires
-        logging.info("Guest is down. Waiting for it to go up again, timeout %ds",
-                     timeout)
-        session = kvm_utils.remote_login(client, address, port, username,
-                                         password, prompt, linesep,
-                                         log_filename, timeout)
-
+        logging.info("Guest is down. Waiting for it to go up again, timeout "
+                     "%ds", timeout)
+        session = kvm_utils.wait_for(
+            lambda: kvm_utils.remote_login(client, address, port, username,
+                                           password, prompt, linesep,
+                                           log_filename), timeout, 0, 2)
         if not session:
             raise error.TestFail("Could not log into guest after reboot")
         logging.info("Guest is up again")
@@ -53,16 +53,16 @@ def run_migration_with_reboot(test, params, env):
     session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
 
     # params of reboot
-    username = params.get("username", "")
-    password = params.get("password", "")
-    prompt = params.get("shell_prompt", "[\#\$]")
-    linesep = eval("'%s'" % params.get("shell_linesep", r"\n"))
-    client = params.get("shell_client")
+    username = vm.params.get("username", "")
+    password = vm.params.get("password", "")
+    prompt = vm.params.get("shell_prompt", "[\#\$]")
+    linesep = eval("'%s'" % vm.params.get("shell_linesep", r"\n"))
+    client = vm.params.get("shell_client")
     address = vm.get_address(0)
     port = vm.get_port(int(params.get("shell_port")))
     log_filename = ("migration-reboot-%s-%s.log" %
                     (vm.name, kvm_utils.generate_random_string(4)))
-    reboot_command = params.get("reboot_command")
+    reboot_command = vm.params.get("reboot_command")
 
     mig_timeout = float(params.get("mig_timeout", "3600"))
     mig_protocol = params.get("migration_protocol", "tcp")
Signature · 1 line
1.7.3.3
#3 lore raw

PATCH 3/28 KVM test: corrections to migration_with_reboot

Quoted 3 lines · Michael Goldish

- Use wait_for() to try remote_login() multiple times before giving up.
- Take VM parameters from vm.params, not params.

Is there any differnce between those in current context? Other looks good, thanks.

Quoted 67 lines
---
 client/tests/kvm/tests/migration_with_reboot.py |   26 +++++++++++-----------
 1 files changed, 13 insertions(+), 13 deletions(-)
client/tests/kvm/tests/migration_with_reboot.py +13 -13
index 5673b45..5070dbc 100644
@@ -24,7 +24,7 @@ def run_migration_with_reboot(test, params, env):
                     password, prompt, linesep, log_filename, timeout):
         """
         A version of reboot test which is safe to be called in the background as
-        it only needs an vm object
+        it doesn't need a VM object.
         """
         # Send a reboot command to the guest's shell
         session.sendline(reboot_command)
@@ -37,12 +37,12 @@ def run_migration_with_reboot(test, params, env):
         session.close()
 
         # Try logging into the guest until timeout expires
-        logging.info("Guest is down. Waiting for it to go up again, timeout %ds",
-                     timeout)
-        session = kvm_utils.remote_login(client, address, port, username,
-                                         password, prompt, linesep,
-                                         log_filename, timeout)
-
+        logging.info("Guest is down. Waiting for it to go up again, timeout "
+                     "%ds", timeout)
+        session = kvm_utils.wait_for(
+            lambda: kvm_utils.remote_login(client, address, port, username,
+                                           password, prompt, linesep,
+                                           log_filename), timeout, 0, 2)
         if not session:
             raise error.TestFail("Could not log into guest after reboot")
         logging.info("Guest is up again")
@@ -53,16 +53,16 @@ def run_migration_with_reboot(test, params, env):
     session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
 
     # params of reboot
-    username = params.get("username", "")
-    password = params.get("password", "")
-    prompt = params.get("shell_prompt", "[\#\$]")
-    linesep = eval("'%s'" % params.get("shell_linesep", r"\n"))
-    client = params.get("shell_client")
+    username = vm.params.get("username", "")
+    password = vm.params.get("password", "")
+    prompt = vm.params.get("shell_prompt", "[\#\$]")
+    linesep = eval("'%s'" % vm.params.get("shell_linesep", r"\n"))
+    client = vm.params.get("shell_client")
     address = vm.get_address(0)
     port = vm.get_port(int(params.get("shell_port")))
     log_filename = ("migration-reboot-%s-%s.log" %
                     (vm.name, kvm_utils.generate_random_string(4)))
-    reboot_command = params.get("reboot_command")
+    reboot_command = vm.params.get("reboot_command")
 
     mig_timeout = float(params.get("mig_timeout", "3600"))
     mig_protocol = params.get("migration_protocol", "tcp")
Signature · 6 lines
1.7.3.3

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

Re: [KVM-AUTOTEST PATCH 03/28] KVM test: corrections to migration_with_reboot

Quoted 7 lines · Jason Wang
Quoted 3 lines · Michael Goldish

- Use wait_for() to try remote_login() multiple times before giving up.
- Take VM parameters from vm.params, not params.

Is there any differnce between those in current context? Other looks good, thanks.

In the current context no, but there can be a difference in odd cases such as:

vms = vm1 vm2
main_vm = vm2
password = 1234
password_vm2 = 5678

In that case params['password'] is 1234 but vm.params['password'] is 5678 (because main_vm = vm2).

Quoted 71 lines
Quoted 67 lines
---
 client/tests/kvm/tests/migration_with_reboot.py |   26 +++++++++++-----------
 1 files changed, 13 insertions(+), 13 deletions(-)
client/tests/kvm/tests/migration_with_reboot.py +13 -13
index 5673b45..5070dbc 100644
@@ -24,7 +24,7 @@ def run_migration_with_reboot(test, params, env):
                     password, prompt, linesep, log_filename, timeout):
         """
         A version of reboot test which is safe to be called in the background as
-        it only needs an vm object
+        it doesn't need a VM object.
         """
         # Send a reboot command to the guest's shell
         session.sendline(reboot_command)
@@ -37,12 +37,12 @@ def run_migration_with_reboot(test, params, env):
         session.close()
 
         # Try logging into the guest until timeout expires
-        logging.info("Guest is down. Waiting for it to go up again, timeout %ds",
-                     timeout)
-        session = kvm_utils.remote_login(client, address, port, username,
-                                         password, prompt, linesep,
-                                         log_filename, timeout)
-
+        logging.info("Guest is down. Waiting for it to go up again, timeout "
+                     "%ds", timeout)
+        session = kvm_utils.wait_for(
+            lambda: kvm_utils.remote_login(client, address, port, username,
+                                           password, prompt, linesep,
+                                           log_filename), timeout, 0, 2)
         if not session:
             raise error.TestFail("Could not log into guest after reboot")
         logging.info("Guest is up again")
@@ -53,16 +53,16 @@ def run_migration_with_reboot(test, params, env):
     session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
 
     # params of reboot
-    username = params.get("username", "")
-    password = params.get("password", "")
-    prompt = params.get("shell_prompt", "[\#\$]")
-    linesep = eval("'%s'" % params.get("shell_linesep", r"\n"))
-    client = params.get("shell_client")
+    username = vm.params.get("username", "")
+    password = vm.params.get("password", "")
+    prompt = vm.params.get("shell_prompt", "[\#\$]")
+    linesep = eval("'%s'" % vm.params.get("shell_linesep", r"\n"))
+    client = vm.params.get("shell_client")
     address = vm.get_address(0)
     port = vm.get_port(int(params.get("shell_port")))
     log_filename = ("migration-reboot-%s-%s.log" %
                     (vm.name, kvm_utils.generate_random_string(4)))
-    reboot_command = params.get("reboot_command")
+    reboot_command = vm.params.get("reboot_command")
 
     mig_timeout = float(params.get("mig_timeout", "3600"))
     mig_protocol = params.get("migration_protocol", "tcp")
Signature · 6 lines
1.7.3.3

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

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

#5 lore raw

PATCH 4/28 KVM test: migration_with_reboot: use kvm_utils.Thread

In reply to Michael Goldish
---
 client/tests/kvm/tests/migration_with_reboot.py |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)
client/tests/kvm/tests/migration_with_reboot.py +7 -12
index 5070dbc..af5de64 100644
@@ -19,7 +19,6 @@ def run_migration_with_reboot(test, params, env):
     @param params: Dictionary with test parameters.
     @param env: Dictionary with the test environment.
     """
-
     def reboot_test(client, session, address, reboot_command, port, username,
                     password, prompt, linesep, log_filename, timeout):
         """
@@ -67,24 +66,20 @@ def run_migration_with_reboot(test, params, env):
     mig_timeout = float(params.get("mig_timeout", "3600"))
     mig_protocol = params.get("migration_protocol", "tcp")
     mig_cancel = bool(params.get("mig_cancel"))
-    bg = None
 
     try:
-        # reboot the VM in background
-        bg = kvm_test_utils.BackgroundTest(reboot_test,
-                                           (client, session, address,
+        # Reboot the VM in the background
+        bg = kvm_utils.Thread(reboot_test, (client, session, address,
                                             reboot_command, port, username,
                                             password, prompt, linesep,
                                             log_filename, timeout))
         bg.start()
 
-        while bg.is_alive():
-            # Migrate the VM
-            dest_vm = kvm_test_utils.migrate(vm, env, mig_timeout, mig_protocol,
-                                             False)
-            vm = dest_vm
+        try:
+            while bg.is_alive():
+                vm = kvm_test_utils.migrate(vm, env, mig_timeout, mig_protocol)
+        finally:
+            bg.join()
 
     finally:
-        if bg:
-            bg.join()
         session.close()
Signature · 1 line
1.7.3.3
#6 lore raw

PATCH 4/28 KVM test: migration_with_reboot: use kvm_utils.Thread

Quoted 1 line · Michael Goldish

Looks good, thanks!

Quoted 55 lines
---
 client/tests/kvm/tests/migration_with_reboot.py |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)
client/tests/kvm/tests/migration_with_reboot.py +7 -12
index 5070dbc..af5de64 100644
@@ -19,7 +19,6 @@ def run_migration_with_reboot(test, params, env):
     @param params: Dictionary with test parameters.
     @param env: Dictionary with the test environment.
     """
-
     def reboot_test(client, session, address, reboot_command, port, username,
                     password, prompt, linesep, log_filename, timeout):
         """
@@ -67,24 +66,20 @@ def run_migration_with_reboot(test, params, env):
     mig_timeout = float(params.get("mig_timeout", "3600"))
     mig_protocol = params.get("migration_protocol", "tcp")
     mig_cancel = bool(params.get("mig_cancel"))
-    bg = None
 
     try:
-        # reboot the VM in background
-        bg = kvm_test_utils.BackgroundTest(reboot_test,
-                                           (client, session, address,
+        # Reboot the VM in the background
+        bg = kvm_utils.Thread(reboot_test, (client, session, address,
                                             reboot_command, port, username,
                                             password, prompt, linesep,
                                             log_filename, timeout))
         bg.start()
 
-        while bg.is_alive():
-            # Migrate the VM
-            dest_vm = kvm_test_utils.migrate(vm, env, mig_timeout, mig_protocol,
-                                             False)
-            vm = dest_vm
+        try:
+            while bg.is_alive():
+                vm = kvm_test_utils.migrate(vm, env, mig_timeout, mig_protocol)
+        finally:
+            bg.join()
 
     finally:
-        if bg:
-            bg.join()
         session.close()
Signature · 6 lines
1.7.3.3

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

PATCH 5/28 KVM test: vmstop: use kvm_utils.Thread

In reply to Michael Goldish
---
 client/tests/kvm/tests/vmstop.py |   61 ++++++++++++++++++-------------------
 1 files changed, 30 insertions(+), 31 deletions(-)
client/tests/kvm/tests/vmstop.py +30 -31
index 703c881..876c3ef 100644
@@ -29,55 +29,54 @@ def run_vmstop(test, params, env):
 
     guest_path = params.get("guest_path", "/tmp")
     file_size = params.get("file_size", "1000")
-    bg = None
 
     try:
         utils.run("dd if=/dev/zero of=/tmp/file bs=1M count=%s" % file_size)
         # Transfer file from host to guest, we didn't expect the finish of
         # transfer, we just let it to be a kind of stress in guest.
-        bg = kvm_test_utils.BackgroundTest(vm.copy_files_to,
-                                           ("/tmp/file", guest_path,
-                                            0, 60))
+        bg = kvm_utils.Thread(vm.copy_files_to, ("/tmp/file",
+                                                 guest_path, 0, 60))
         logging.info("Start the background transfer")
         bg.start()
 
-        # wait for the transfer start
-        time.sleep(5)
-        logging.info("Stop the VM")
-        vm.monitor.cmd("stop")
+        try:
+            # wait for the transfer start
+            time.sleep(5)
+            logging.info("Stop the VM")
+            vm.monitor.cmd("stop")
 
-        # check with monitor
-        logging.info("Check the status through monitor")
-        if "paused" not in vm.monitor.info("status"):
-            raise error.TestFail("Guest did not pause after sending stop")
+            # check with monitor
+            logging.info("Check the status through monitor")
+            if "paused" not in vm.monitor.info("status"):
+                raise error.TestFail("Guest did not pause after sending stop")
 
-        # check through session
-        logging.info("Check the session")
-        if session.is_responsive():
-            raise error.TestFail("Session still alive after sending stop")
+            # check through session
+            logging.info("Check the session")
+            if session.is_responsive():
+                raise error.TestFail("Session still alive after sending stop")
 
-        # Check with the migration file
-        logging.info("Save and check the state files")
-        for p in [save1, save2]:
-            vm.save_to_file(p)
-            time.sleep(1)
-            if not os.path.isfile(p):
-                raise error.TestFail("VM failed to save state file %s" % p)
+            # Check with the migration file
+            logging.info("Save and check the state files")
+            for p in [save1, save2]:
+                vm.save_to_file(p)
+                time.sleep(1)
+                if not os.path.isfile(p):
+                    raise error.TestFail("VM failed to save state file %s" % p)
 
-        # Fail if we see deltas
-        md5_save1 = utils.hash_file(save1)
-        md5_save2 = utils.hash_file(save2)
-        if md5_save1 != md5_save2:
-            raise error.TestFail("The produced state files differ")
+            # Fail if we see deltas
+            md5_save1 = utils.hash_file(save1)
+            md5_save2 = utils.hash_file(save2)
+            if md5_save1 != md5_save2:
+                raise error.TestFail("The produced state files differ")
+        finally:
+            bg.join()
 
     finally:
+        session.close()
         if clean_save:
             logging.debug("Clean the state files")
             if os.path.isfile(save1):
                 os.remove(save1)
             if os.path.isfile(save2):
                 os.remove(save2)
-        if bg:
-            bg.join()
         vm.monitor.cmd("cont")
-        session.close()
Signature · 1 line
1.7.3.3
#8 lore raw

PATCH 5/28 KVM test: vmstop: use kvm_utils.Thread

Quoted 1 line · Michael Goldish

Looks good to me, thanks.

Quoted 101 lines
---
 client/tests/kvm/tests/vmstop.py |   61 ++++++++++++++++++-------------------
 1 files changed, 30 insertions(+), 31 deletions(-)
client/tests/kvm/tests/vmstop.py +30 -31
index 703c881..876c3ef 100644
@@ -29,55 +29,54 @@ def run_vmstop(test, params, env):
 
     guest_path = params.get("guest_path", "/tmp")
     file_size = params.get("file_size", "1000")
-    bg = None
 
     try:
         utils.run("dd if=/dev/zero of=/tmp/file bs=1M count=%s" % file_size)
         # Transfer file from host to guest, we didn't expect the finish of
         # transfer, we just let it to be a kind of stress in guest.
-        bg = kvm_test_utils.BackgroundTest(vm.copy_files_to,
-                                           ("/tmp/file", guest_path,
-                                            0, 60))
+        bg = kvm_utils.Thread(vm.copy_files_to, ("/tmp/file",
+                                                 guest_path, 0, 60))
         logging.info("Start the background transfer")
         bg.start()
 
-        # wait for the transfer start
-        time.sleep(5)
-        logging.info("Stop the VM")
-        vm.monitor.cmd("stop")
+        try:
+            # wait for the transfer start
+            time.sleep(5)
+            logging.info("Stop the VM")
+            vm.monitor.cmd("stop")
 
-        # check with monitor
-        logging.info("Check the status through monitor")
-        if "paused" not in vm.monitor.info("status"):
-            raise error.TestFail("Guest did not pause after sending stop")
+            # check with monitor
+            logging.info("Check the status through monitor")
+            if "paused" not in vm.monitor.info("status"):
+                raise error.TestFail("Guest did not pause after sending stop")
 
-        # check through session
-        logging.info("Check the session")
-        if session.is_responsive():
-            raise error.TestFail("Session still alive after sending stop")
+            # check through session
+            logging.info("Check the session")
+            if session.is_responsive():
+                raise error.TestFail("Session still alive after sending stop")
 
-        # Check with the migration file
-        logging.info("Save and check the state files")
-        for p in [save1, save2]:
-            vm.save_to_file(p)
-            time.sleep(1)
-            if not os.path.isfile(p):
-                raise error.TestFail("VM failed to save state file %s" % p)
+            # Check with the migration file
+            logging.info("Save and check the state files")
+            for p in [save1, save2]:
+                vm.save_to_file(p)
+                time.sleep(1)
+                if not os.path.isfile(p):
+                    raise error.TestFail("VM failed to save state file %s" % p)
 
-        # Fail if we see deltas
-        md5_save1 = utils.hash_file(save1)
-        md5_save2 = utils.hash_file(save2)
-        if md5_save1 != md5_save2:
-            raise error.TestFail("The produced state files differ")
+            # Fail if we see deltas
+            md5_save1 = utils.hash_file(save1)
+            md5_save2 = utils.hash_file(save2)
+            if md5_save1 != md5_save2:
+                raise error.TestFail("The produced state files differ")
+        finally:
+            bg.join()
 
     finally:
+        session.close()
         if clean_save:
             logging.debug("Clean the state files")
             if os.path.isfile(save1):
                 os.remove(save1)
             if os.path.isfile(save2):
                 os.remove(save2)
-        if bg:
-            bg.join()
         vm.monitor.cmd("cont")
-        session.close()
Signature · 6 lines
1.7.3.3

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

PATCH 6/28 KVM test: migration_with_file_transfer: use kvm_utils.Thread

In reply to Michael Goldish
---
 .../kvm/tests/migration_with_file_transfer.py      |   42 +++++++-------------
 1 files changed, 15 insertions(+), 27 deletions(-)
client/tests/kvm/tests/migration_with_file_transfer.py +15 -27
index 4be70cd..3fb4945 100644
@@ -18,15 +18,6 @@ def run_migration_with_file_transfer(test, params, env):
     @param params: Dictionary with test parameters.
     @param env: Dictionary with the test environment.
     """
-
-    def transfer_test(address, client, username, password, port, local_path,
-                      remote_path, log_filename, timeout):
-        # kvm_utils.copy_files_to does not raise exception, so we need a wrapper
-        # in order to make it to be used by BackgroundTest.
-        if not kvm_utils.copy_files_to(address, client, username, password,
-                      port, local_path, remote_path, log_filename, timeout):
-            raise error.TestError("Fail to do the file transfer!")
-
     vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
     timeout = int(params.get("login_timeout", 360))
     session = kvm_test_utils.wait_for_login(vm, timeout=timeout)
@@ -47,29 +38,26 @@ def run_migration_with_file_transfer(test, params, env):
     file_size = params.get("file_size", "1000")
     transfer_timeout = int(params.get("transfer_timeout", "240"))
 
-    bg = None
-
     try:
         utils.run("dd if=/dev/zero of=/tmp/file bs=1M count=%s" % file_size)
 
         # Transfer file from host to guest in the backgroud
-        bg = kvm_test_utils.BackgroundTest(transfer_test,
-                                           (address, client, username, password,
-                                            port, "/tmp/file", guest_path,
-                                            log_filename, transfer_timeout))
+        bg = kvm_utils.Thread(kvm_utils.copy_files_to,
+                              (address, client, username, password, port,
+                               "/tmp/file", guest_path, log_filename,
+                               transfer_timeout))
         bg.start()
+        try:
+            while bg.is_alive():
+                logging.info("File transfer not ended, starting a round of "
+                             "migration...")
+                vm = kvm_test_utils.migrate(vm, env, mig_timeout, mig_protocol)
+        finally:
+            # bg.join() returns the value returned by copy_files_to()
+            if not bg.join():
+                raise error.TestFail("File transfer failed")
 
-        while bg.is_alive():
-            logging.info("File transfer is not ended, start a round of"
-                         "migration ...")
-
-            # Migrate the VM
-            dest_vm = kvm_test_utils.migrate(vm, env, mig_timeout,
-                                             mig_protocol, False)
-
-            vm = dest_vm
     finally:
-        if bg: bg.join()
         session.close()
-        if os.path.isfile("/tmp/zero"):
-            os.remove("/tmp/zero")
+        if os.path.isfile("/tmp/file"):
+            os.remove("/tmp/file")
Signature · 1 line
1.7.3.3
#10 lore raw

PATCH 7/28 KVM test: migration_with_file_transfer: use unique host filename

In reply to Michael Goldish

If the same constant filename is used every time, multiple instances of the test cannot run concurrently.

---
 .../kvm/tests/migration_with_file_transfer.py      |   12 +++++++-----
 client/tests/kvm/tests_base.cfg.sample             |    2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)
client/tests/kvm/tests/migration_with_file_transfer.py +7 -5
index 3fb4945..73e70b9 100644
@@ -34,17 +34,19 @@ def run_migration_with_file_transfer(test, params, env):
     log_filename = ("migration-transfer-%s-to-%s-%s.log" %
                     (vm.name, address,
                      kvm_utils.generate_random_string(4)))
-    guest_path = params.get("guest_path", "/tmp")
+    host_path = "/tmp/file-%s" % kvm_utils.generate_random_string(6)
+    guest_path = params.get("guest_path", "/tmp/file")
     file_size = params.get("file_size", "1000")
     transfer_timeout = int(params.get("transfer_timeout", "240"))
 
     try:
-        utils.run("dd if=/dev/zero of=/tmp/file bs=1M count=%s" % file_size)
+        utils.run("dd if=/dev/zero of=%s bs=1M count=%s" % (host_path,
+                                                            file_size))
 
         # Transfer file from host to guest in the backgroud
         bg = kvm_utils.Thread(kvm_utils.copy_files_to,
                               (address, client, username, password, port,
-                               "/tmp/file", guest_path, log_filename,
+                               host_path, guest_path, log_filename,
                                transfer_timeout))
         bg.start()
         try:
@@ -59,5 +61,5 @@ def run_migration_with_file_transfer(test, params, env):
 
     finally:
         session.close()
-        if os.path.isfile("/tmp/file"):
-            os.remove("/tmp/file")
+        if os.path.isfile(host_path):
+            os.remove(host_path)
client/tests/kvm/tests_base.cfg.sample +1 -1
index 4075bfc..06cb063 100644
@@ -1598,7 +1598,7 @@ variants:
             migration_bg_check_command = tasklist | find /I "ping.exe"
             migration_bg_kill_command = taskkill /IM ping.exe /F
         migrate.with_file_transfer:
-            guest_path = C:\
+            guest_path = C:\tmpfile
             rtl8139:
                 file_size = 10
         stress_boot:
Signature · 1 line
1.7.3.3
#11 lore raw

PATCH 8/28 KVM test: migration_with_file_transfer: verify transfer correctness

In reply to Michael Goldish

After the transfer, copy the file back from the guest to the host and make sure the returned file is identical to the one sent to the guest.

---
 .../kvm/tests/migration_with_file_transfer.py      |   34 +++++++++++++++++---
 1 files changed, 29 insertions(+), 5 deletions(-)
client/tests/kvm/tests/migration_with_file_transfer.py +29 -5
index 73e70b9..6a2ab06 100644
@@ -35,15 +35,16 @@ def run_migration_with_file_transfer(test, params, env):
                     (vm.name, address,
                      kvm_utils.generate_random_string(4)))
     host_path = "/tmp/file-%s" % kvm_utils.generate_random_string(6)
+    host_path_returned = "%s-returned" % host_path
     guest_path = params.get("guest_path", "/tmp/file")
-    file_size = params.get("file_size", "1000")
+    file_size = params.get("file_size", "500")
     transfer_timeout = int(params.get("transfer_timeout", "240"))
 
     try:
-        utils.run("dd if=/dev/zero of=%s bs=1M count=%s" % (host_path,
-                                                            file_size))
+        utils.run("dd if=/dev/urandom of=%s bs=1M count=%s" % (host_path,
+                                                               file_size))
 
-        # Transfer file from host to guest in the backgroud
+        logging.info("Transferring file from host to guest")
         bg = kvm_utils.Thread(kvm_utils.copy_files_to,
                               (address, client, username, password, port,
                                host_path, guest_path, log_filename,
@@ -57,9 +58,32 @@ def run_migration_with_file_transfer(test, params, env):
         finally:
             # bg.join() returns the value returned by copy_files_to()
             if not bg.join():
-                raise error.TestFail("File transfer failed")
+                raise error.TestFail("File transfer from host to guest failed")
+
+        logging.info("Transferring file back from guest to host")
+        bg = kvm_utils.Thread(kvm_utils.copy_files_from,
+                              (address, client, username, password, port,
+                               host_path, guest_path, log_filename,
+                               transfer_timeout))
+        bg.start()
+        try:
+            while bg.is_alive():
+                logging.info("File transfer not ended, starting a round of "
+                             "migration...")
+                vm = kvm_test_utils.migrate(vm, env, mig_timeout, mig_protocol)
+        finally:
+            if not bg.join():
+                raise error.TestFail("File transfer from guest to host failed")
+
+        # Make sure the returned file is indentical to the original one
+        orig_hash = utils.hash_file(host_path)
+        returned_hash = utils.hash_file(host_path_returned)
+        if orig_hash != returned_hash:
+            raise error.TestFail("Returned file differs from original one")
 
     finally:
         session.close()
         if os.path.isfile(host_path):
             os.remove(host_path)
+        if os.path.isfile(host_path_returned):
+            os.remove(host_path_returned)
Signature · 1 line
1.7.3.3
#12 lore raw

PATCH 9/28 KVM test: remove kvm_test_utils.BackgroundTest

In reply to Michael Goldish

kvm_utils.Thread is used instead.

---
 client/tests/kvm/kvm_test_utils.py |   47 ------------------------------------
 1 files changed, 0 insertions(+), 47 deletions(-)
client/tests/kvm/kvm_test_utils.py +0 -47
index 2a3a062..6569d3b 100644
@@ -593,53 +593,6 @@ def run_autotest(vm, session, control_path, timeout, outputdir):
         raise error.TestFail(e_msg)
 
 
-class BackgroundTest(object):
-    """
-    This class would run a test in background through a dedicated thread.
-    """
-
-    def __init__(self, func, params):
-        """
-        Initialize the object and set a few attributes.
-        """
-        self.thread = threading.Thread(target=self.launch,
-                                       args=(func, params))
-        self.exception = None
-
-
-    def launch(self, func, params):
-        """
-        Catch and record the exception.
-        """
-        try:
-            func(*params)
-        except Exception, e:
-            self.exception = e
-
-
-    def start(self):
-        """
-        Run func(params) in a dedicated thread
-        """
-        self.thread.start()
-
-
-    def join(self):
-        """
-        Wait for the join of thread and raise its exception if any.
-        """
-        self.thread.join()
-        if self.exception:
-            raise self.exception
-
-
-    def is_alive(self):
-        """
-        Check whether the test is still alive.
-        """
-        return self.thread.isAlive()
-
-
 def get_loss_ratio(output):
     """
     Get the packet loss ratio from the output of ping
Signature · 1 line
1.7.3.3
#13 lore raw

PATCH 10/28 KVM test: avoid printing address cache messages too often

In reply to Michael Goldish

Currently, messages such as

(address cache) Adding cache entry: 11:22:33:44:55:66 ---> 10.20.30.40

are displayed for every IP address assignment caught by tcpdump. These often occur in clusters. Therefore, to avoid bloating the log files, print a message only if the last message for the same MAC address was printed more than 5 seconds ago.

---
 client/tests/kvm/kvm_preprocessing.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
client/tests/kvm/kvm_preprocessing.py +4 -2
index d2f94cd..90382cc 100644
@@ -384,9 +384,11 @@ def _update_address_cache(address_cache, line):
         matches = re.findall(r"\w*:\w*:\w*:\w*:\w*:\w*", line)
         if matches and address_cache.get("last_seen"):
             mac_address = matches[0].lower()
-            logging.debug("(address cache) Adding cache entry: %s ---> %s",
-                          mac_address, address_cache.get("last_seen"))
+            if time.time() - address_cache.get("time_%s" % mac_address, 0) > 5:
+                logging.debug("(address cache) Adding cache entry: %s ---> %s",
+                              mac_address, address_cache.get("last_seen"))
             address_cache[mac_address] = address_cache.get("last_seen")
+            address_cache["time_%s" % mac_address] = time.time()
             del address_cache["last_seen"]
 
 
Signature · 1 line
1.7.3.3
#14 lore raw

PATCH 11/28 KVM test: make_qemu_command(): catch IndexError when accessing self.netdev_id

In reply to Michael Goldish

make_qemu_command() is sometimes called to see if a VM needs to be restarted using a different qemu command line. When it's called with more NICs than the VM currently has, accessing self.netdev_id can raise an IndexError.

---
 client/tests/kvm/kvm_vm.py |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
client/tests/kvm/kvm_vm.py +7 -5
index 6aa8eb4..aeb7448 100755
@@ -402,11 +402,14 @@ class VM:
         vlan = 0
         for nic_name in kvm_utils.get_sub_dict_names(params, "nics"):
             nic_params = kvm_utils.get_sub_dict(params, nic_name)
+            try:
+                netdev_id = self.netdev_id[vlan]
+            except IndexError:
+                netdev_id = None
             # Handle the '-net nic' part
             mac = self.get_mac_address(vlan)
             qemu_cmd += add_nic(help, vlan, nic_params.get("nic_model"), mac,
-                                self.netdev_id[vlan],
-                                nic_params.get("nic_extra_params"))
+                                netdev_id, nic_params.get("nic_extra_params"))
             # Handle the '-net tap' or '-net user' part
             script = nic_params.get("nic_script")
             downscript = nic_params.get("nic_downscript")
@@ -420,9 +423,8 @@ class VM:
             qemu_cmd += add_net(help, vlan, nic_params.get("nic_mode", "user"),
                                 self.get_ifname(vlan),
                                 script, downscript, tftp,
-                                nic_params.get("bootp"), redirs,
-                                self.netdev_id[vlan],
-                                nic_params.get("netdev_extra_params"))
+                                nic_params.get("bootp"), redirs, netdev_id,
+                                nic_params.get("vhost") == "yes")
             # Proceed to next NIC
             vlan += 1
 
Signature · 1 line
1.7.3.3
#15 lore raw

PATCH 11/28 KVM test: make_qemu_command(): catch IndexError when accessing self.netdev_id

Quoted 31 lines · Michael Goldish

make_qemu_command() is sometimes called to see if a VM needs to be restarted using a different qemu command line. When it's called with more NICs than the VM currently has, accessing self.netdev_id can raise an IndexError.

---
 client/tests/kvm/kvm_vm.py |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
client/tests/kvm/kvm_vm.py +5 -2
index 6aa8eb4..aeb7448 100755
@@ -402,11 +402,14 @@ class VM:
         vlan = 0
         for nic_name in kvm_utils.get_sub_dict_names(params, "nics"):
             nic_params = kvm_utils.get_sub_dict(params, nic_name)
+            try:
+                netdev_id = self.netdev_id[vlan]
+            except IndexError:
+                netdev_id = None
             # Handle the '-net nic' part
             mac = self.get_mac_address(vlan)
             qemu_cmd += add_nic(help, vlan, nic_params.get("nic_model"), mac,
-                                self.netdev_id[vlan],
-                                nic_params.get("nic_extra_params"))
+                                netdev_id, nic_params.get("nic_extra_params"))
             # Handle the '-net tap' or '-net user' part
             script = nic_params.get("nic_script")
             downscript = nic_params.get("nic_downscript")

client/tests/kvm/kvm_vm.py class VM: · line 427

Quoted 8 lines
client/tests/kvm/kvm_vm.py +2 -3
@@ -420,9 +423,8 @@ class VM:
             qemu_cmd += add_net(help, vlan, nic_params.get("nic_mode", "user"),
                                 self.get_ifname(vlan),
                                 script, downscript, tftp,
-                                nic_params.get("bootp"), redirs,
-                                self.netdev_id[vlan],
-                                nic_params.get("netdev_extra_params"))
+                                nic_params.get("bootp"), redirs, netdev_id,
+                                nic_params.get("vhost") == "yes")

Why drop netdev_extra_params here, we've used it to enable vhost. And it seems the bootp is useless here as we've already used "-kernel" and "-initrd" to do the unattended installation.

Quoted 10 lines
client/tests/kvm/kvm_vm.py +0 -0
             # Proceed to next NIC
             vlan += 1
 
Signature · 6 lines
1.7.3.3

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

Re: [Autotest] [KVM-AUTOTEST PATCH 11/28] KVM test: make_qemu_command(): catch IndexError when accessing self.netdev_id

Quoted 34 lines · Jason Wang
Quoted 33 lines · Michael Goldish

make_qemu_command() is sometimes called to see if a VM needs to be restarted using a different qemu command line. When it's called with more NICs than the VM currently has, accessing self.netdev_id can raise an IndexError.

---
 client/tests/kvm/kvm_vm.py |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
client/tests/kvm/kvm_vm.py +5 -2
index 6aa8eb4..aeb7448 100755
@@ -402,11 +402,14 @@ class VM:
         vlan = 0
         for nic_name in kvm_utils.get_sub_dict_names(params, "nics"):
             nic_params = kvm_utils.get_sub_dict(params, nic_name)
+            try:
+                netdev_id = self.netdev_id[vlan]
+            except IndexError:
+                netdev_id = None
             # Handle the '-net nic' part
             mac = self.get_mac_address(vlan)
             qemu_cmd += add_nic(help, vlan, nic_params.get("nic_model"), mac,
-                                self.netdev_id[vlan],
-                                nic_params.get("nic_extra_params"))
+                                netdev_id, nic_params.get("nic_extra_params"))
             # Handle the '-net tap' or '-net user' part
             script = nic_params.get("nic_script")
             downscript = nic_params.get("nic_downscript")
@@ -420,9 +423,8 @@ class VM:
             qemu_cmd += add_net(help, vlan, nic_params.get("nic_mode", "user"),
                                 self.get_ifname(vlan),
Quoted 8 lines

client/tests/kvm/kvm_vm.py class VM: · line 427

Quoted 6 lines
client/tests/kvm/kvm_vm.py +2 -3
                                 script, downscript, tftp,
-                                nic_params.get("bootp"), redirs,
-                                self.netdev_id[vlan],
-                                nic_params.get("netdev_extra_params"))
+                                nic_params.get("bootp"), redirs, netdev_id,
+                                nic_params.get("vhost") == "yes")

Why drop netdev_extra_params here, we've used it to enable vhost. And it seems

This is a rebase mistake. I'll fix it and re-post the patch. Thanks.

Quoted 2 lines

the bootp is useless here as we've already used "-kernel" and "-initrd" to do the unattended installation.

If we decide to remove bootp we should do it in a different patch.

Quoted 14 lines
Quoted 10 lines
client/tests/kvm/kvm_vm.py +0 -0
             # Proceed to next NIC
             vlan += 1
 
Signature · 6 lines
1.7.3.3

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

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

#17 lore raw

PATCH 12/28 KVM test: use VM.clone() in make_qemu_command()

In reply to Michael Goldish

When make_qemu_command() is called in order to see if a VM should be restarted using a different qemu command line, construction of the qemu command should be based only on the parameters provided to make_qemu_command() (name, params, root_dir). However, some VM methods are called which use the internal state of the VM (self.params). For example, when calling make_qemu_command() with params that define 3 NICs, for a VM that currently has only 1 NIC, make_qemu_command() will call VM.get_ifname() for 2 NICs that don't exist in self.params.
To solve this, allow VM.clone() to copy the state of the VM to the clone, and use such a clone with altered params in make_qemu_command(), instead of using 'self'. That way, all methods that use self.params will use the correct (altered) params in make_qemu_command().

---
 client/tests/kvm/kvm_vm.py |   72 ++++++++++++++++++++++++++-----------------
 1 files changed, 43 insertions(+), 29 deletions(-)
client/tests/kvm/kvm_vm.py +43 -29
index aeb7448..b80d2c2 100755
@@ -97,7 +97,7 @@ class VM:
     This class handles all basic VM operations.
     """
 
-    def __init__(self, name, params, root_dir, address_cache):
+    def __init__(self, name, params, root_dir, address_cache, state=None):
         """
         Initialize the object and set a few attributes.
 
@@ -106,30 +106,35 @@ class VM:
                 (see method make_qemu_command for a full description)
         @param root_dir: Base directory for relative filenames
         @param address_cache: A dict that maps MAC addresses to IP addresses
+        @param state: If provided, use this as self.__dict__
         """
-        self.process = None
-        self.serial_console = None
-        self.redirs = {}
-        self.vnc_port = 5900
-        self.monitors = []
-        self.pci_assignable = None
-        self.netdev_id = []
-        self.uuid = None
+        if state:
+            self.__dict__ = state
+        else:
+            self.process = None
+            self.serial_console = None
+            self.redirs = {}
+            self.vnc_port = 5900
+            self.monitors = []
+            self.pci_assignable = None
+            self.netdev_id = []
+            self.uuid = None
+
+            # Find a unique identifier for this VM
+            while True:
+                self.instance = (time.strftime("%Y%m%d-%H%M%S-") +
+                                 kvm_utils.generate_random_string(4))
+                if not glob.glob("/tmp/*%s" % self.instance):
+                    break
 
         self.name = name
         self.params = params
         self.root_dir = root_dir
         self.address_cache = address_cache
 
-        # Find a unique identifier for this VM
-        while True:
-            self.instance = (time.strftime("%Y%m%d-%H%M%S-") +
-                             kvm_utils.generate_random_string(4))
-            if not glob.glob("/tmp/*%s" % self.instance):
-                break
-
 
-    def clone(self, name=None, params=None, root_dir=None, address_cache=None):
+    def clone(self, name=None, params=None, root_dir=None, address_cache=None,
+              copy_state=False):
         """
         Return a clone of the VM object with optionally modified parameters.
         The clone is initially not alive and needs to be started using create().
@@ -140,6 +145,8 @@ class VM:
         @param params: Optional new VM creation parameters
         @param root_dir: Optional new base directory for relative filenames
         @param address_cache: A dict that maps MAC addresses to IP addresses
+        @param copy_state: If True, copy the original VM's state to the clone.
+                Mainly useful for make_qemu_command().
         """
         if name is None:
             name = self.name
@@ -149,7 +156,11 @@ class VM:
             root_dir = self.root_dir
         if address_cache is None:
             address_cache = self.address_cache
-        return VM(name, params, root_dir, address_cache)
+        if copy_state:
+            state = self.__dict__.copy()
+        else:
+            state = None
+        return VM(name, params, root_dir, address_cache, state)
 
 
     def make_qemu_command(self, name=None, params=None, root_dir=None):
@@ -350,6 +361,9 @@ class VM:
         if params is None: params = self.params
         if root_dir is None: root_dir = self.root_dir
 
+        # Clone this VM using the new params
+        vm = self.clone(name, params, root_dir, copy_state=True)
+
         qemu_binary = kvm_utils.get_path(root_dir, params.get("qemu_binary",
                                                               "qemu"))
         # Get the output of 'qemu -help' (log a message in case this call never
@@ -369,14 +383,14 @@ class VM:
         # Add monitors
         for monitor_name in kvm_utils.get_sub_dict_names(params, "monitors"):
             monitor_params = kvm_utils.get_sub_dict(params, monitor_name)
-            monitor_filename = self.get_monitor_filename(monitor_name)
+            monitor_filename = vm.get_monitor_filename(monitor_name)
             if monitor_params.get("monitor_type") == "qmp":
                 qemu_cmd += add_qmp_monitor(help, monitor_filename)
             else:
                 qemu_cmd += add_human_monitor(help, monitor_filename)
 
         # Add serial console redirection
-        qemu_cmd += add_serial(help, self.get_serial_console_filename())
+        qemu_cmd += add_serial(help, vm.get_serial_console_filename())
 
         for image_name in kvm_utils.get_sub_dict_names(params, "images"):
             image_params = kvm_utils.get_sub_dict(params, image_name)
@@ -396,18 +410,18 @@ class VM:
         for redir_name in kvm_utils.get_sub_dict_names(params, "redirs"):
             redir_params = kvm_utils.get_sub_dict(params, redir_name)
             guest_port = int(redir_params.get("guest_port"))
-            host_port = self.redirs.get(guest_port)
+            host_port = vm.redirs.get(guest_port)
             redirs += [(host_port, guest_port)]
 
         vlan = 0
         for nic_name in kvm_utils.get_sub_dict_names(params, "nics"):
             nic_params = kvm_utils.get_sub_dict(params, nic_name)
             try:
-                netdev_id = self.netdev_id[vlan]
+                netdev_id = vm.netdev_id[vlan]
             except IndexError:
                 netdev_id = None
             # Handle the '-net nic' part
-            mac = self.get_mac_address(vlan)
+            mac = vm.get_mac_address(vlan)
             qemu_cmd += add_nic(help, vlan, nic_params.get("nic_model"), mac,
                                 netdev_id, nic_params.get("nic_extra_params"))
             # Handle the '-net tap' or '-net user' part
@@ -421,7 +435,7 @@ class VM:
             if tftp:
                 tftp = kvm_utils.get_path(root_dir, tftp)
             qemu_cmd += add_net(help, vlan, nic_params.get("nic_mode", "user"),
-                                self.get_ifname(vlan),
+                                vm.get_ifname(vlan),
                                 script, downscript, tftp,
                                 nic_params.get("bootp"), redirs, netdev_id,
                                 nic_params.get("vhost") == "yes")
@@ -478,27 +492,27 @@ class VM:
             qemu_cmd += add_tcp_redir(help, host_port, guest_port)
 
         if params.get("display") == "vnc":
-            qemu_cmd += add_vnc(help, self.vnc_port)
+            qemu_cmd += add_vnc(help, vm.vnc_port)
         elif params.get("display") == "sdl":
             qemu_cmd += add_sdl(help)
         elif params.get("display") == "nographic":
             qemu_cmd += add_nographic(help)
 
         if params.get("uuid") == "random":
-            qemu_cmd += add_uuid(help, self.uuid)
+            qemu_cmd += add_uuid(help, vm.uuid)
         elif params.get("uuid"):
             qemu_cmd += add_uuid(help, params.get("uuid"))
 
         if params.get("testdev") == "yes":
-            qemu_cmd += add_testdev(help, self.get_testlog_filename())
+            qemu_cmd += add_testdev(help, vm.get_testlog_filename())
 
         if params.get("disable_hpet") == "yes":
             qemu_cmd += add_no_hpet(help)
 
         # If the PCI assignment step went OK, add each one of the PCI assigned
         # devices to the qemu command line.
-        if self.pci_assignable:
-            for pci_id in self.pa_pci_ids:
+        if vm.pci_assignable:
+            for pci_id in vm.pa_pci_ids:
                 qemu_cmd += add_pcidevice(help, pci_id)
 
         extra_params = params.get("extra_params")
Signature · 1 line
1.7.3.3
#18 lore raw

PATCH 12/28 KVM test: use VM.clone() in make_qemu_command()

Quoted 4 lines · Michael Goldish

When make_qemu_command() is called in order to see if a VM should be restarted using a different qemu command line, construction of the qemu command should be based only on the parameters provided to make_qemu_command() (name, params, root_dir). However, some VM methods are called which use the internal state of

Quoted 9 lines

the VM (self.params). For example, when calling make_qemu_command() with params that define 3 NICs, for a VM that currently has only 1 NIC, make_qemu_command() will call VM.get_ifname() for 2 NICs that don't exist in self.params.
To solve this, allow VM.clone() to copy the state of the VM to the clone, and use such a clone with altered params in make_qemu_command(), instead of using 'self'. That way, all methods that use self.params will use the correct (altered) params in make_qemu_command().

If we use VM.clone() we also need to destroy it as it may left entries in mac address pool. Other looks good.

Quoted 190 lines
---
 client/tests/kvm/kvm_vm.py |   72 ++++++++++++++++++++++++++-----------------
 1 files changed, 43 insertions(+), 29 deletions(-)
client/tests/kvm/kvm_vm.py +43 -29
index aeb7448..b80d2c2 100755
@@ -97,7 +97,7 @@ class VM:
     This class handles all basic VM operations.
     """
 
-    def __init__(self, name, params, root_dir, address_cache):
+    def __init__(self, name, params, root_dir, address_cache, state=None):
         """
         Initialize the object and set a few attributes.
 
@@ -106,30 +106,35 @@ class VM:
                 (see method make_qemu_command for a full description)
         @param root_dir: Base directory for relative filenames
         @param address_cache: A dict that maps MAC addresses to IP addresses
+        @param state: If provided, use this as self.__dict__
         """
-        self.process = None
-        self.serial_console = None
-        self.redirs = {}
-        self.vnc_port = 5900
-        self.monitors = []
-        self.pci_assignable = None
-        self.netdev_id = []
-        self.uuid = None
+        if state:
+            self.__dict__ = state
+        else:
+            self.process = None
+            self.serial_console = None
+            self.redirs = {}
+            self.vnc_port = 5900
+            self.monitors = []
+            self.pci_assignable = None
+            self.netdev_id = []
+            self.uuid = None
+
+            # Find a unique identifier for this VM
+            while True:
+                self.instance = (time.strftime("%Y%m%d-%H%M%S-") +
+                                 kvm_utils.generate_random_string(4))
+                if not glob.glob("/tmp/*%s" % self.instance):
+                    break
 
         self.name = name
         self.params = params
         self.root_dir = root_dir
         self.address_cache = address_cache
 
-        # Find a unique identifier for this VM
-        while True:
-            self.instance = (time.strftime("%Y%m%d-%H%M%S-") +
-                             kvm_utils.generate_random_string(4))
-            if not glob.glob("/tmp/*%s" % self.instance):
-                break
-
 
-    def clone(self, name=None, params=None, root_dir=None, address_cache=None):
+    def clone(self, name=None, params=None, root_dir=None, address_cache=None,
+              copy_state=False):
         """
         Return a clone of the VM object with optionally modified parameters.
         The clone is initially not alive and needs to be started using create().
@@ -140,6 +145,8 @@ class VM:
         @param params: Optional new VM creation parameters
         @param root_dir: Optional new base directory for relative filenames
         @param address_cache: A dict that maps MAC addresses to IP addresses
+        @param copy_state: If True, copy the original VM's state to the clone.
+                Mainly useful for make_qemu_command().
         """
         if name is None:
             name = self.name
@@ -149,7 +156,11 @@ class VM:
             root_dir = self.root_dir
         if address_cache is None:
             address_cache = self.address_cache
-        return VM(name, params, root_dir, address_cache)
+        if copy_state:
+            state = self.__dict__.copy()
+        else:
+            state = None
+        return VM(name, params, root_dir, address_cache, state)
 
 
     def make_qemu_command(self, name=None, params=None, root_dir=None):
@@ -350,6 +361,9 @@ class VM:
         if params is None: params = self.params
         if root_dir is None: root_dir = self.root_dir
 
+        # Clone this VM using the new params
+        vm = self.clone(name, params, root_dir, copy_state=True)
+
         qemu_binary = kvm_utils.get_path(root_dir, params.get("qemu_binary",
                                                               "qemu"))
         # Get the output of 'qemu -help' (log a message in case this call never
@@ -369,14 +383,14 @@ class VM:
         # Add monitors
         for monitor_name in kvm_utils.get_sub_dict_names(params, "monitors"):
             monitor_params = kvm_utils.get_sub_dict(params, monitor_name)
-            monitor_filename = self.get_monitor_filename(monitor_name)
+            monitor_filename = vm.get_monitor_filename(monitor_name)
             if monitor_params.get("monitor_type") == "qmp":
                 qemu_cmd += add_qmp_monitor(help, monitor_filename)
             else:
                 qemu_cmd += add_human_monitor(help, monitor_filename)
 
         # Add serial console redirection
-        qemu_cmd += add_serial(help, self.get_serial_console_filename())
+        qemu_cmd += add_serial(help, vm.get_serial_console_filename())
 
         for image_name in kvm_utils.get_sub_dict_names(params, "images"):
             image_params = kvm_utils.get_sub_dict(params, image_name)
@@ -396,18 +410,18 @@ class VM:
         for redir_name in kvm_utils.get_sub_dict_names(params, "redirs"):
             redir_params = kvm_utils.get_sub_dict(params, redir_name)
             guest_port = int(redir_params.get("guest_port"))
-            host_port = self.redirs.get(guest_port)
+            host_port = vm.redirs.get(guest_port)
             redirs += [(host_port, guest_port)]
 
         vlan = 0
         for nic_name in kvm_utils.get_sub_dict_names(params, "nics"):
             nic_params = kvm_utils.get_sub_dict(params, nic_name)
             try:
-                netdev_id = self.netdev_id[vlan]
+                netdev_id = vm.netdev_id[vlan]
             except IndexError:
                 netdev_id = None
             # Handle the '-net nic' part
-            mac = self.get_mac_address(vlan)
+            mac = vm.get_mac_address(vlan)
             qemu_cmd += add_nic(help, vlan, nic_params.get("nic_model"), mac,
                                 netdev_id, nic_params.get("nic_extra_params"))
             # Handle the '-net tap' or '-net user' part
@@ -421,7 +435,7 @@ class VM:
             if tftp:
                 tftp = kvm_utils.get_path(root_dir, tftp)
             qemu_cmd += add_net(help, vlan, nic_params.get("nic_mode", "user"),
-                                self.get_ifname(vlan),
+                                vm.get_ifname(vlan),
                                 script, downscript, tftp,
                                 nic_params.get("bootp"), redirs, netdev_id,
                                 nic_params.get("vhost") == "yes")
@@ -478,27 +492,27 @@ class VM:
             qemu_cmd += add_tcp_redir(help, host_port, guest_port)
 
         if params.get("display") == "vnc":
-            qemu_cmd += add_vnc(help, self.vnc_port)
+            qemu_cmd += add_vnc(help, vm.vnc_port)
         elif params.get("display") == "sdl":
             qemu_cmd += add_sdl(help)
         elif params.get("display") == "nographic":
             qemu_cmd += add_nographic(help)
 
         if params.get("uuid") == "random":
-            qemu_cmd += add_uuid(help, self.uuid)
+            qemu_cmd += add_uuid(help, vm.uuid)
         elif params.get("uuid"):
             qemu_cmd += add_uuid(help, params.get("uuid"))
 
         if params.get("testdev") == "yes":
-            qemu_cmd += add_testdev(help, self.get_testlog_filename())
+            qemu_cmd += add_testdev(help, vm.get_testlog_filename())
 
         if params.get("disable_hpet") == "yes":
             qemu_cmd += add_no_hpet(help)
 
         # If the PCI assignment step went OK, add each one of the PCI assigned
         # devices to the qemu command line.
-        if self.pci_assignable:
-            for pci_id in self.pa_pci_ids:
+        if vm.pci_assignable:
+            for pci_id in vm.pa_pci_ids:
                 qemu_cmd += add_pcidevice(help, pci_id)
 
         extra_params = params.get("extra_params")
Signature · 6 lines
1.7.3.3

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

Re: [KVM-AUTOTEST PATCH 12/28] KVM test: use VM.clone() in make_qemu_command()

Quoted 15 lines · Jason Wang
Quoted 4 lines · Michael Goldish

When make_qemu_command() is called in order to see if a VM should be restarted using a different qemu command line, construction of the qemu command should be based only on the parameters provided to make_qemu_command() (name, params, root_dir). However, some VM methods are called which use the internal state of

Quoted 9 lines

the VM (self.params). For example, when calling make_qemu_command() with params that define 3 NICs, for a VM that currently has only 1 NIC, make_qemu_command() will call VM.get_ifname() for 2 NICs that don't exist in self.params.
To solve this, allow VM.clone() to copy the state of the VM to the clone, and use such a clone with altered params in make_qemu_command(), instead of using 'self'. That way, all methods that use self.params will use the correct (altered) params in make_qemu_command().

Quoted 2 lines

If we use VM.clone() we also need to destroy it as it may left entries in mac address pool. Other looks good.

I don't think so because the clone doesn't do anything except allow proper access to VM data. The clone shares the same instance string with the original VM, so they share the same address pool entries. If we destroy() the clone, the original VM will be destroyed too.

The above is only true because we pass copy_state=True to clone(). If we didn't do that, the clone would be independent with its own instance string and would have to be create()d separately.

Quoted 194 lines
Quoted 190 lines
---
 client/tests/kvm/kvm_vm.py |   72 ++++++++++++++++++++++++++-----------------
 1 files changed, 43 insertions(+), 29 deletions(-)
client/tests/kvm/kvm_vm.py +43 -29
index aeb7448..b80d2c2 100755
@@ -97,7 +97,7 @@ class VM:
     This class handles all basic VM operations.
     """
 
-    def __init__(self, name, params, root_dir, address_cache):
+    def __init__(self, name, params, root_dir, address_cache, state=None):
         """
         Initialize the object and set a few attributes.
 
@@ -106,30 +106,35 @@ class VM:
                 (see method make_qemu_command for a full description)
         @param root_dir: Base directory for relative filenames
         @param address_cache: A dict that maps MAC addresses to IP addresses
+        @param state: If provided, use this as self.__dict__
         """
-        self.process = None
-        self.serial_console = None
-        self.redirs = {}
-        self.vnc_port = 5900
-        self.monitors = []
-        self.pci_assignable = None
-        self.netdev_id = []
-        self.uuid = None
+        if state:
+            self.__dict__ = state
+        else:
+            self.process = None
+            self.serial_console = None
+            self.redirs = {}
+            self.vnc_port = 5900
+            self.monitors = []
+            self.pci_assignable = None
+            self.netdev_id = []
+            self.uuid = None
+
+            # Find a unique identifier for this VM
+            while True:
+                self.instance = (time.strftime("%Y%m%d-%H%M%S-") +
+                                 kvm_utils.generate_random_string(4))
+                if not glob.glob("/tmp/*%s" % self.instance):
+                    break
 
         self.name = name
         self.params = params
         self.root_dir = root_dir
         self.address_cache = address_cache
 
-        # Find a unique identifier for this VM
-        while True:
-            self.instance = (time.strftime("%Y%m%d-%H%M%S-") +
-                             kvm_utils.generate_random_string(4))
-            if not glob.glob("/tmp/*%s" % self.instance):
-                break
-
 
-    def clone(self, name=None, params=None, root_dir=None, address_cache=None):
+    def clone(self, name=None, params=None, root_dir=None, address_cache=None,
+              copy_state=False):
         """
         Return a clone of the VM object with optionally modified parameters.
         The clone is initially not alive and needs to be started using create().
@@ -140,6 +145,8 @@ class VM:
         @param params: Optional new VM creation parameters
         @param root_dir: Optional new base directory for relative filenames
         @param address_cache: A dict that maps MAC addresses to IP addresses
+        @param copy_state: If True, copy the original VM's state to the clone.
+                Mainly useful for make_qemu_command().
         """
         if name is None:
             name = self.name
@@ -149,7 +156,11 @@ class VM:
             root_dir = self.root_dir
         if address_cache is None:
             address_cache = self.address_cache
-        return VM(name, params, root_dir, address_cache)
+        if copy_state:
+            state = self.__dict__.copy()
+        else:
+            state = None
+        return VM(name, params, root_dir, address_cache, state)
 
 
     def make_qemu_command(self, name=None, params=None, root_dir=None):
@@ -350,6 +361,9 @@ class VM:
         if params is None: params = self.params
         if root_dir is None: root_dir = self.root_dir
 
+        # Clone this VM using the new params
+        vm = self.clone(name, params, root_dir, copy_state=True)
+
         qemu_binary = kvm_utils.get_path(root_dir, params.get("qemu_binary",
                                                               "qemu"))
         # Get the output of 'qemu -help' (log a message in case this call never
@@ -369,14 +383,14 @@ class VM:
         # Add monitors
         for monitor_name in kvm_utils.get_sub_dict_names(params, "monitors"):
             monitor_params = kvm_utils.get_sub_dict(params, monitor_name)
-            monitor_filename = self.get_monitor_filename(monitor_name)
+            monitor_filename = vm.get_monitor_filename(monitor_name)
             if monitor_params.get("monitor_type") == "qmp":
                 qemu_cmd += add_qmp_monitor(help, monitor_filename)
             else:
                 qemu_cmd += add_human_monitor(help, monitor_filename)
 
         # Add serial console redirection
-        qemu_cmd += add_serial(help, self.get_serial_console_filename())
+        qemu_cmd += add_serial(help, vm.get_serial_console_filename())
 
         for image_name in kvm_utils.get_sub_dict_names(params, "images"):
             image_params = kvm_utils.get_sub_dict(params, image_name)
@@ -396,18 +410,18 @@ class VM:
         for redir_name in kvm_utils.get_sub_dict_names(params, "redirs"):
             redir_params = kvm_utils.get_sub_dict(params, redir_name)
             guest_port = int(redir_params.get("guest_port"))
-            host_port = self.redirs.get(guest_port)
+            host_port = vm.redirs.get(guest_port)
             redirs += [(host_port, guest_port)]
 
         vlan = 0
         for nic_name in kvm_utils.get_sub_dict_names(params, "nics"):
             nic_params = kvm_utils.get_sub_dict(params, nic_name)
             try:
-                netdev_id = self.netdev_id[vlan]
+                netdev_id = vm.netdev_id[vlan]
             except IndexError:
                 netdev_id = None
             # Handle the '-net nic' part
-            mac = self.get_mac_address(vlan)
+            mac = vm.get_mac_address(vlan)
             qemu_cmd += add_nic(help, vlan, nic_params.get("nic_model"), mac,
                                 netdev_id, nic_params.get("nic_extra_params"))
             # Handle the '-net tap' or '-net user' part
@@ -421,7 +435,7 @@ class VM:
             if tftp:
                 tftp = kvm_utils.get_path(root_dir, tftp)
             qemu_cmd += add_net(help, vlan, nic_params.get("nic_mode", "user"),
-                                self.get_ifname(vlan),
+                                vm.get_ifname(vlan),
                                 script, downscript, tftp,
                                 nic_params.get("bootp"), redirs, netdev_id,
                                 nic_params.get("vhost") == "yes")
@@ -478,27 +492,27 @@ class VM:
             qemu_cmd += add_tcp_redir(help, host_port, guest_port)
 
         if params.get("display") == "vnc":
-            qemu_cmd += add_vnc(help, self.vnc_port)
+            qemu_cmd += add_vnc(help, vm.vnc_port)
         elif params.get("display") == "sdl":
             qemu_cmd += add_sdl(help)
         elif params.get("display") == "nographic":
             qemu_cmd += add_nographic(help)
 
         if params.get("uuid") == "random":
-            qemu_cmd += add_uuid(help, self.uuid)
+            qemu_cmd += add_uuid(help, vm.uuid)
         elif params.get("uuid"):
             qemu_cmd += add_uuid(help, params.get("uuid"))
 
         if params.get("testdev") == "yes":
-            qemu_cmd += add_testdev(help, self.get_testlog_filename())
+            qemu_cmd += add_testdev(help, vm.get_testlog_filename())
 
         if params.get("disable_hpet") == "yes":
             qemu_cmd += add_no_hpet(help)
 
         # If the PCI assignment step went OK, add each one of the PCI assigned
         # devices to the qemu command line.
-        if self.pci_assignable:
-            for pci_id in self.pa_pci_ids:
+        if vm.pci_assignable:
+            for pci_id in vm.pa_pci_ids:
                 qemu_cmd += add_pcidevice(help, pci_id)
 
         extra_params = params.get("extra_params")
Signature · 6 lines
1.7.3.3

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

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

#20 lore raw

PATCH 13/28 KVM test: don't print the contents of env before and after tests

In reply to Michael Goldish

It produces a lot of output and normally isn't useful.

---
 client/tests/kvm/kvm.py |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
client/tests/kvm/kvm.py +0 -2
index 4dec182..dc00edd 100644
@@ -41,7 +41,6 @@ class kvm(test.test):
                      "messages.")
         env_filename = os.path.join(self.bindir, params.get("env", "env"))
         env = kvm_utils.load_env(env_filename, self.env_version)
-        logging.debug("Contents of environment: %s", env)
 
         test_passed = False
 
@@ -98,7 +97,6 @@ class kvm(test.test):
                                       "postprocessing: %s", e)
                 finally:
                     kvm_utils.dump_env(env, env_filename)
-                    logging.debug("Contents of environment: %s", env)
 
         except Exception, e:
             if params.get("abort_on_error") != "yes":
Signature · 1 line
1.7.3.3
#21 lore raw

PATCH 14/28 KVM test: fix md5sum verification of ISO files

In reply to Michael Goldish

Currently only the 'cdrom' parameter is checked, but now that multiple cdroms can be defined, get_sub_dict() should be used.

This patch also makes sure that 'md5sum' and 'sha1sum' are only set for the same cdrom whose 'cdrom' parameter is set (e.g. 'md5sum_cd1 = ...' instead of 'md5sum = ...'). Otherwise adding a 2nd cdrom such as winutils.iso will result in a hash mismatch.

---
 client/tests/kvm/kvm_vm.py             |   64 +++---
 client/tests/kvm/tests_base.cfg.sample |  368 ++++++++++++++++----------------
 2 files changed, 217 insertions(+), 215 deletions(-)
client/tests/kvm/kvm_vm.py +33 -31
index b80d2c2..a8bee6c 100755
@@ -551,38 +551,40 @@ class VM:
         params = self.params
         root_dir = self.root_dir
 
-        # Verify the md5sum of the ISO image
-        iso = params.get("cdrom")
-        if iso:
-            iso = kvm_utils.get_path(root_dir, iso)
-            if not os.path.exists(iso):
-                logging.error("ISO file not found: %s" % iso)
-                return False
-            compare = False
-            if params.get("md5sum_1m"):
-                logging.debug("Comparing expected MD5 sum with MD5 sum of "
-                              "first MB of ISO file...")
-                actual_hash = utils.hash_file(iso, 1048576, method="md5")
-                expected_hash = params.get("md5sum_1m")
-                compare = True
-            elif params.get("md5sum"):
-                logging.debug("Comparing expected MD5 sum with MD5 sum of ISO "
-                              "file...")
-                actual_hash = utils.hash_file(iso, method="md5")
-                expected_hash = params.get("md5sum")
-                compare = True
-            elif params.get("sha1sum"):
-                logging.debug("Comparing expected SHA1 sum with SHA1 sum of "
-                              "ISO file...")
-                actual_hash = utils.hash_file(iso, method="sha1")
-                expected_hash = params.get("sha1sum")
-                compare = True
-            if compare:
-                if actual_hash == expected_hash:
-                    logging.debug("Hashes match")
-                else:
-                    logging.error("Actual hash differs from expected one")
+        # Verify the md5sum of the ISO images
+        for cdrom in kvm_utils.get_sub_dict_names(params, "cdroms"):
+            cdrom_params = kvm_utils.get_sub_dict(params, cdrom)
+            iso = cdrom_params.get("cdrom")
+            if iso:
+                iso = kvm_utils.get_path(root_dir, iso)
+                if not os.path.exists(iso):
+                    logging.error("ISO file not found: %s" % iso)
                     return False
+                compare = False
+                if cdrom_params.get("md5sum_1m"):
+                    logging.debug("Comparing expected MD5 sum with MD5 sum of "
+                                  "first MB of ISO file...")
+                    actual_hash = utils.hash_file(iso, 1048576, method="md5")
+                    expected_hash = cdrom_params.get("md5sum_1m")
+                    compare = True
+                elif cdrom_params.get("md5sum"):
+                    logging.debug("Comparing expected MD5 sum with MD5 sum of "
+                                  "ISO file...")
+                    actual_hash = utils.hash_file(iso, method="md5")
+                    expected_hash = cdrom_params.get("md5sum")
+                    compare = True
+                elif cdrom_params.get("sha1sum"):
+                    logging.debug("Comparing expected SHA1 sum with SHA1 sum "
+                                  "of ISO file...")
+                    actual_hash = utils.hash_file(iso, method="sha1")
+                    expected_hash = cdrom_params.get("sha1sum")
+                    compare = True
+                if compare:
+                    if actual_hash == expected_hash:
+                        logging.debug("Hashes match")
+                    else:
+                        logging.error("Actual hash differs from expected one")
+                        return False
 
         # Make sure the following code is not executed by more than one thread
         # at the same time
client/tests/kvm/tests_base.cfg.sample +184 -184

874 lines not on this page · raw message

Signature · 1 line
1.7.3.3
#22 lore raw

PATCH 14/28 KVM test: fix md5sum verification of ISO files

Quoted 8 lines · Michael Goldish

Currently only the 'cdrom' parameter is checked, but now that multiple cdroms can be defined, get_sub_dict() should be used.

This patch also makes sure that 'md5sum' and 'sha1sum' are only set for the same cdrom whose 'cdrom' parameter is set (e.g. 'md5sum_cd1 = ...' instead of 'md5sum = ...'). Otherwise adding a 2nd cdrom such as winutils.iso will result in a hash mismatch.

Looks good.

Quoted 1,038 lines
---
 client/tests/kvm/kvm_vm.py             |   64 +++---
 client/tests/kvm/tests_base.cfg.sample |  368 ++++++++++++++++----------------
 2 files changed, 217 insertions(+), 215 deletions(-)
client/tests/kvm/kvm_vm.py +33 -31
index b80d2c2..a8bee6c 100755
@@ -551,38 +551,40 @@ class VM:
         params = self.params
         root_dir = self.root_dir
 
-        # Verify the md5sum of the ISO image
-        iso = params.get("cdrom")
-        if iso:
-            iso = kvm_utils.get_path(root_dir, iso)
-            if not os.path.exists(iso):
-                logging.error("ISO file not found: %s" % iso)
-                return False
-            compare = False
-            if params.get("md5sum_1m"):
-                logging.debug("Comparing expected MD5 sum with MD5 sum of "
-                              "first MB of ISO file...")
-                actual_hash = utils.hash_file(iso, 1048576, method="md5")
-                expected_hash = params.get("md5sum_1m")
-                compare = True
-            elif params.get("md5sum"):
-                logging.debug("Comparing expected MD5 sum with MD5 sum of ISO "
-                              "file...")
-                actual_hash = utils.hash_file(iso, method="md5")
-                expected_hash = params.get("md5sum")
-                compare = True
-            elif params.get("sha1sum"):
-                logging.debug("Comparing expected SHA1 sum with SHA1 sum of "
-                              "ISO file...")
-                actual_hash = utils.hash_file(iso, method="sha1")
-                expected_hash = params.get("sha1sum")
-                compare = True
-            if compare:
-                if actual_hash == expected_hash:
-                    logging.debug("Hashes match")
-                else:
-                    logging.error("Actual hash differs from expected one")
+        # Verify the md5sum of the ISO images
+        for cdrom in kvm_utils.get_sub_dict_names(params, "cdroms"):
+            cdrom_params = kvm_utils.get_sub_dict(params, cdrom)
+            iso = cdrom_params.get("cdrom")
+            if iso:
+                iso = kvm_utils.get_path(root_dir, iso)
+                if not os.path.exists(iso):
+                    logging.error("ISO file not found: %s" % iso)
                     return False
+                compare = False
+                if cdrom_params.get("md5sum_1m"):
+                    logging.debug("Comparing expected MD5 sum with MD5 sum of "
+                                  "first MB of ISO file...")
+                    actual_hash = utils.hash_file(iso, 1048576, method="md5")
+                    expected_hash = cdrom_params.get("md5sum_1m")
+                    compare = True
+                elif cdrom_params.get("md5sum"):
+                    logging.debug("Comparing expected MD5 sum with MD5 sum of "
+                                  "ISO file...")
+                    actual_hash = utils.hash_file(iso, method="md5")
+                    expected_hash = cdrom_params.get("md5sum")
+                    compare = True
+                elif cdrom_params.get("sha1sum"):
+                    logging.debug("Comparing expected SHA1 sum with SHA1 sum "
+                                  "of ISO file...")
+                    actual_hash = utils.hash_file(iso, method="sha1")
+                    expected_hash = cdrom_params.get("sha1sum")
+                    compare = True
+                if compare:
+                    if actual_hash == expected_hash:
+                        logging.debug("Hashes match")
+                    else:
+                        logging.error("Actual hash differs from expected one")
+                        return False
 
         # Make sure the following code is not executed by more than one thread
         # at the same time
client/tests/kvm/tests_base.cfg.sample +184 -184
index 06cb063..ff02a72 100644
@@ -830,8 +830,8 @@ variants:
                         install:
                             steps = Fedora-8-i386.steps
                             cdrom_cd1 = isos/linux/Fedora-8-i386-DVD.iso
-                            md5sum = dd6c79fddfff36d409d02242e7b10189
-                            md5sum_1m = dabae451bb69fbbad0e505b25144b1f9
+                            md5sum_cd1 = dd6c79fddfff36d409d02242e7b10189
+                            md5sum_1m_cd1 = dabae451bb69fbbad0e505b25144b1f9
                         unattended_install:
                             unattended_file = unattended/Fedora-8.ks
                             #floppy = images/f8-32/ks.vfd
@@ -840,8 +840,8 @@ variants:
                             initrd = images/f8-32/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/Fedora-8-i386-DVD.iso
-                            md5sum = dd6c79fddfff36d409d02242e7b10189
-                            md5sum_1m = dabae451bb69fbbad0e505b25144b1f9
+                            md5sum_cd1 = dd6c79fddfff36d409d02242e7b10189
+                            md5sum_1m_cd1 = dabae451bb69fbbad0e505b25144b1f9
 
                     - 8.64:
                         no setup
@@ -849,8 +849,8 @@ variants:
                         install:
                             steps = Fedora-8-64.steps
                             cdrom_cd1 = isos/linux/Fedora-8-x86_64-DVD.iso
-                            md5sum = 2cb231a86709dec413425fd2f8bf5295
-                            md5sum_1m = 145f6414e19492649a56c89f0a45e719
+                            md5sum_cd1 = 2cb231a86709dec413425fd2f8bf5295
+                            md5sum_1m_cd1 = 145f6414e19492649a56c89f0a45e719
                         unattended_install:
                             unattended_file = unattended/Fedora-8.ks
                             #floppy = images/f8-64/ks.vfd
@@ -859,16 +859,16 @@ variants:
                             initrd = images/f8-64/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/Fedora-8-x86_64-DVD.iso
-                            md5sum = 2cb231a86709dec413425fd2f8bf5295
-                            md5sum_1m = 145f6414e19492649a56c89f0a45e719
+                            md5sum_cd1 = 2cb231a86709dec413425fd2f8bf5295
+                            md5sum_1m_cd1 = 145f6414e19492649a56c89f0a45e719
 
                     - 9.32:
                         image_name = f9-32
                         install:
                             steps = Fedora-9-i386.steps
                             cdrom_cd1 = isos/linux/Fedora-9-i386-DVD.iso
-                            md5sum = 72601f685ea8c808c303353d8bf4d307
-                            md5sum_1m = f24fa25689e5863f1b99984c6feb787f
+                            md5sum_cd1 = 72601f685ea8c808c303353d8bf4d307
+                            md5sum_1m_cd1 = f24fa25689e5863f1b99984c6feb787f
                         unattended_install:
                             unattended_file = unattended/Fedora-9.ks
                             #floppy = images/f9-32/ks.vfd
@@ -877,8 +877,8 @@ variants:
                             initrd = images/f9-32/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/Fedora-9-i386-DVD.iso
-                            md5sum = 72601f685ea8c808c303353d8bf4d307
-                            md5sum_1m = f24fa25689e5863f1b99984c6feb787f
+                            md5sum_cd1 = 72601f685ea8c808c303353d8bf4d307
+                            md5sum_1m_cd1 = f24fa25689e5863f1b99984c6feb787f
 
 
                     - 9.64:
@@ -886,8 +886,8 @@ variants:
                         install:
                             steps = Fedora-9-64.steps
                             cdrom_cd1 = isos/linux/Fedora-9-x86_64-DVD.iso
-                            md5sum = 05b2ebeed273ec54d6f9ed3d61ea4c96
-                            md5sum_1m = 9822ab5097e37e8fe306ef2192727db4
+                            md5sum_cd1 = 05b2ebeed273ec54d6f9ed3d61ea4c96
+                            md5sum_1m_cd1 = 9822ab5097e37e8fe306ef2192727db4
                         unattended_install:
                             unattended_file = unattended/Fedora-9.ks
                             #floppy = images/f9-64/ks.vfd
@@ -896,8 +896,8 @@ variants:
                             initrd = images/f9-64/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/Fedora-9-x86_64-DVD.iso
-                            md5sum = 05b2ebeed273ec54d6f9ed3d61ea4c96
-                            md5sum_1m = 9822ab5097e37e8fe306ef2192727db4
+                            md5sum_cd1 = 05b2ebeed273ec54d6f9ed3d61ea4c96
+                            md5sum_1m_cd1 = 9822ab5097e37e8fe306ef2192727db4
 
 
                     - 10.32:
@@ -910,8 +910,8 @@ variants:
                             initrd = images/f10-32/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/Fedora-10-i386-DVD.iso
-                            md5sum = 27e581edb392728c4a07d00d3fc5ced0
-                            md5sum_1m = bd67c68bdf595e4ba7131ec702159181
+                            md5sum_cd1 = 27e581edb392728c4a07d00d3fc5ced0
+                            md5sum_1m_cd1 = bd67c68bdf595e4ba7131ec702159181
 
                     - 10.64:
                         image_name = f10-64
@@ -923,8 +923,8 @@ variants:
                             initrd = images/f10-64/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/Fedora-10-x86_64-DVD.iso
-                            sha1sum = f1e5ae7db6a1ba227de7294c4112385922388648
-                            md5sum_1m = 732857cbf40c80c34683e874601d982c
+                            sha1sum_cd1 = f1e5ae7db6a1ba227de7294c4112385922388648
+                            md5sum_1m_cd1 = 732857cbf40c80c34683e874601d982c
 
                     - 11.32:
                         image_name = f11-32
@@ -938,8 +938,8 @@ variants:
                             initrd = images/f11-32/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/Fedora-11-i386-DVD.iso
-                            md5sum = e3b1e2d1ba42aa4705fa5f41771b3927
-                            md5sum_1m = dc8ddf90648c247339c721395aa49714
+                            md5sum_cd1 = e3b1e2d1ba42aa4705fa5f41771b3927
+                            md5sum_1m_cd1 = dc8ddf90648c247339c721395aa49714
 
                     - 11.64:
                         image_name = f11-64
@@ -951,8 +951,8 @@ variants:
                             initrd = images/f11-64/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/Fedora-11-x86_64-DVD.iso
-                            md5sum = 9d419844adeb93120215fe7505c9bce8
-                            md5sum_1m = 405ee05e2387a2e4328b008d5bcbdd1e
+                            md5sum_cd1 = 9d419844adeb93120215fe7505c9bce8
+                            md5sum_1m_cd1 = 405ee05e2387a2e4328b008d5bcbdd1e
 
                     - 12.32:
                         image_name = f12-32
@@ -964,8 +964,8 @@ variants:
                             initrd = images/f12-32/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/Fedora-12-i386-DVD.iso
-                            md5sum = 2c4c1c0d09f2fbcfd8ee6a0c5542eeb2
-                            md5sum_1m = eee935d7f0cf2ef03f6ddce3a2a50050
+                            md5sum_cd1 = 2c4c1c0d09f2fbcfd8ee6a0c5542eeb2
+                            md5sum_1m_cd1 = eee935d7f0cf2ef03f6ddce3a2a50050
 
                     - 12.64:
                         image_name = f12-64
@@ -977,8 +977,8 @@ variants:
                             initrd = images/f12-64/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/Fedora-12-x86_64-DVD.iso
-                            md5sum = 6dd31e292cc2eb1140544e9b1ba61c56
-                            md5sum_1m = 514efbd7698b55ff6768c8605438bfc5
+                            md5sum_cd1 = 6dd31e292cc2eb1140544e9b1ba61c56
+                            md5sum_1m_cd1 = 514efbd7698b55ff6768c8605438bfc5
 
                     - 13.32:
                         image_name = f13-32
@@ -990,8 +990,8 @@ variants:
                             initrd = images/f13-32/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/Fedora-13-i386-DVD.iso
-                            md5sum = 212fec517c2629b4b5eaf3662ac13136
-                            md5sum_1m = 4e1578a6ed5a6e7cd03b8fb074030746
+                            md5sum_cd1 = 212fec517c2629b4b5eaf3662ac13136
+                            md5sum_1m_cd1 = 4e1578a6ed5a6e7cd03b8fb074030746
 
                     - 13.64:
                         image_name = f13-64
@@ -1003,8 +1003,8 @@ variants:
                             initrd = images/f13-64/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/Fedora-13-x86_64-DVD.iso
-                            md5sum = 6fbae6379cf27f36e1f2c7827ba7dc35
-                            md5sum_1m = 68821b9de4d3b5975d6634334e7f47a6
+                            md5sum_cd1 = 6fbae6379cf27f36e1f2c7827ba7dc35
+                            md5sum_1m_cd1 = 68821b9de4d3b5975d6634334e7f47a6
 
                     - 14.32:
                         image_name = f14-32
@@ -1016,8 +1016,8 @@ variants:
                             initrd = images/f14-32/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/Fedora-14-i386-DVD.iso
-                            md5sum = 1cc67641506d2f931d669b8d3528dded
-                            md5sum_1m = d314ab126dabab686111e6a0d71d2e67
+                            md5sum_cd1 = 1cc67641506d2f931d669b8d3528dded
+                            md5sum_1m_cd1 = d314ab126dabab686111e6a0d71d2e67
 
                     - 14.64:
                         image_name = f14-64
@@ -1029,8 +1029,8 @@ variants:
                             initrd = images/f14-64/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/Fedora-14-x86_64-DVD.iso
-                            md5sum = f2ebf941dc45f99ee3e8a457c9544552
-                            md5sum_1m = df029f9cffbc3517937a91124a1e0c3a
+                            md5sum_cd1 = f2ebf941dc45f99ee3e8a457c9544552
+                            md5sum_1m_cd1 = df029f9cffbc3517937a91124a1e0c3a
 
 
 
@@ -1040,16 +1040,16 @@ variants:
                 install:
                     steps = DSL-4.2.5.steps
                     cdrom_cd1 = isos/linux/dsl-4.2.5.iso
-                    md5sum = 61694888aede3e01229865b8e6acd4a1
-                    md5sum_1m = 527f2481bd25310f2e3a6e5345ff3d12
+                    md5sum_cd1 = 61694888aede3e01229865b8e6acd4a1
+                    md5sum_1m_cd1 = 527f2481bd25310f2e3a6e5345ff3d12
 
             - Mandriva-One-2007:
                 only install
                 image_name = mandriva-one-2007
                 steps = Mandriva-One-2007-32.steps
                 cdrom_cd1 = isos/linux/mandriva-one-2007-i386.iso
-                md5sum = 7e9e183dc11b9d39f480238e4e12bb05
-                md5sum_1m = dc7865a75db665efc86d59bca7c1fe07
+                md5sum_cd1 = 7e9e183dc11b9d39f480238e4e12bb05
+                md5sum_1m_cd1 = dc7865a75db665efc86d59bca7c1fe07
 
             - OpenSUSE:
                 no setup
@@ -1067,8 +1067,8 @@ variants:
                         install:
                             steps = openSUSE-11.0-32.steps
                             cdrom_cd1 = isos/linux/openSUSE-11.0-DVD-i386.iso
-                            md5sum = ed6a5b3feb668866df812b1c2aed9d7f
-                            md5sum_1m = c720b30557af758e69de450409516369
+                            md5sum_cd1 = ed6a5b3feb668866df812b1c2aed9d7f
+                            md5sum_1m_cd1 = c720b30557af758e69de450409516369
                         unattended_install:
                             unattended_file = unattended/OpenSUSE-11.xml
                             floppy = images/opensuse-11-0-32/autoyast.vfd
@@ -1078,8 +1078,8 @@ variants:
                             boot_path = boot/i386/loader
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/openSUSE-11.0-DVD-i386.iso
-                            md5sum = ed6a5b3feb668866df812b1c2aed9d7f
-                            md5sum_1m = c720b30557af758e69de450409516369
+                            md5sum_cd1 = ed6a5b3feb668866df812b1c2aed9d7f
+                            md5sum_1m_cd1 = c720b30557af758e69de450409516369
 
 
                     - 11.0.64:
@@ -1093,16 +1093,16 @@ variants:
                             boot_path = boot/x86_64/loader
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/openSUSE-11.0-DVD-x86_64.iso
-                            md5sum = 512c8346b0f8eb35f28c4eb96454d391
-                            md5sum_1m = 661aa4cd031df2f25ea0102318a3f4d1
+                            md5sum_cd1 = 512c8346b0f8eb35f28c4eb96454d391
+                            md5sum_1m_cd1 = 661aa4cd031df2f25ea0102318a3f4d1
 
                     - 11.1.32:
                         image_name = openSUSE-11.1-32
                         install:
-                            steps=openSUSE-11.1-32-and-64.steps
+                            steps = openSUSE-11.1-32-and-64.steps
                             cdrom_cd1 = isos/linux/openSUSE-11.1-DVD-i586.iso
-                            md5sum = 8f51b278c0415be28c5699e465444bd3
-                            md5sum_1m = b70217417468389083429f81ba7ce2bd
+                            md5sum_cd1 = 8f51b278c0415be28c5699e465444bd3
+                            md5sum_1m_cd1 = b70217417468389083429f81ba7ce2bd
                         unattended_install:
                             unattended_file = unattended/OpenSUSE-11.xml
                             floppy = images/opensuse-11-1-32/autoyast.vfd
@@ -1112,16 +1112,16 @@ variants:
                             boot_path = boot/i386/loader
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/openSUSE-11.1-DVD-i586.iso
-                            md5sum = 8f51b278c0415be28c5699e465444bd3
-                            md5sum_1m = b70217417468389083429f81ba7ce2bd
+                            md5sum_cd1 = 8f51b278c0415be28c5699e465444bd3
+                            md5sum_1m_cd1 = b70217417468389083429f81ba7ce2bd
 
                     - 11.1.64:
                         image_name = openSUSE-11.1-64
                         install:
                             steps=openSUSE-11.1-32-and-64.steps
                             cdrom_cd1 = isos/linux/openSUSE-11.1-DVD-x86_64.iso
-                            md5sum = 2afee1b8a87175e6dee2b8dbbd1ad8e8
-                            md5sum_1m = 768ca32503ef92c28f2d144f2a87e4d0
+                            md5sum_cd1 = 2afee1b8a87175e6dee2b8dbbd1ad8e8
+                            md5sum_1m_cd1 = 768ca32503ef92c28f2d144f2a87e4d0
                         unattended_install:
                             unattended_file = unattended/OpenSUSE-11.xml
                             floppy = images/opensuse-11-1-64/autoyast.vfd
@@ -1131,8 +1131,8 @@ variants:
                             boot_path = boot/x86_64/loader
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/openSUSE-11.1-DVD-x86_64.iso
-                            md5sum = 2afee1b8a87175e6dee2b8dbbd1ad8e8
-                            md5sum_1m = 768ca32503ef92c28f2d144f2a87e4d0
+                            md5sum_cd1 = 2afee1b8a87175e6dee2b8dbbd1ad8e8
+                            md5sum_1m_cd1 = 768ca32503ef92c28f2d144f2a87e4d0
 
 
                     - 11.2.32:
@@ -1146,8 +1146,8 @@ variants:
                             boot_path = boot/i386/loader
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/openSUSE-11.2-DVD-i586.iso
-                            md5sum = 295d713314a30ad017948f0d542c6d92
-                            md5sum_1m = 1f8767d00acb492be5a5627c834e543f
+                            md5sum_cd1 = 295d713314a30ad017948f0d542c6d92
+                            md5sum_1m_cd1 = 1f8767d00acb492be5a5627c834e543f
 
 
                     - 11.2.64:
@@ -1161,8 +1161,8 @@ variants:
                             boot_path = boot/x86_64/loader
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/openSUSE-11.2-DVD-x86_64.iso
-                            md5sum = 6a09295e34dc030319d040f67f4742c6
-                            md5sum_1m = 11fd11d39744450b898f04c371dde2e7
+                            md5sum_cd1 = 6a09295e34dc030319d040f67f4742c6
+                            md5sum_1m_cd1 = 11fd11d39744450b898f04c371dde2e7
 
                     - 11.3.32:
                         image_name = openSUSE-11.3-32
@@ -1175,8 +1175,8 @@ variants:
                             boot_path = boot/i386/loader
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/openSUSE-11.3-DVD-i586.iso
-                            md5sum = 1a1da28c84e3cdad750d5cfa21c4fd17
-                            md5sum_1m = 4dd26906ce6cb3946519cb0b0de4b0f8
+                            md5sum_cd1 = 1a1da28c84e3cdad750d5cfa21c4fd17
+                            md5sum_1m_cd1 = 4dd26906ce6cb3946519cb0b0de4b0f8
 
                     - 11.3.64:
                         image_name = openSUSE-11.3-64
@@ -1189,8 +1189,8 @@ variants:
                             boot_path = boot/x86_64/loader
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/openSUSE-11.3-DVD-x86_64.iso
-                            md5sum = adf5d2a0a03c1e3aaf102fd6a4771b87
-                            md5sum_1m = e0dd12dac30d296417256775e1234c6e
+                            md5sum_cd1 = adf5d2a0a03c1e3aaf102fd6a4771b87
+                            md5sum_1m_cd1 = e0dd12dac30d296417256775e1234c6e
 
             - SLES:
                 shell_prompt = "^root@.*[\#\$]\s*$|#"
@@ -1215,15 +1215,15 @@ variants:
                             boot_path = boot/i386/loader
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/SLES-11-DVD-i586-GM-DVD1.iso
-                            md5sum = 4958d4dde2575666355c8a1c5858bab0
-                            md5sum_1m = 1f19d4eff5bcead2a3e5b8b4212b6796
+                            md5sum_cd1 = 4958d4dde2575666355c8a1c5858bab0
+                            md5sum_1m_cd1 = 1f19d4eff5bcead2a3e5b8b4212b6796
 
 
                     - 11.0.64:
                         image_name = sles11-64
                         cdrom_cd1 = isos/linux/SLES-11-DVD-x86_64-GM-DVD1.iso
-                        md5sum = 50a2bd45cd12c3808c3ee48208e2586b
-                        md5sum_1m = 00000951cab7c32e332362fc424c1054
+                        md5sum_cd1 = 50a2bd45cd12c3808c3ee48208e2586b
+                        md5sum_1m_cd1 = 00000951cab7c32e332362fc424c1054
                         unattended_install:
                             unattended_file = unattended/SLES-11.xml
                             floppy = images/sles-11-0-64/autoyast.vfd
@@ -1233,8 +1233,8 @@ variants:
                             boot_path = boot/x86_64/loader
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/SLES-11-DVD-x86_64-GM-DVD1.iso
-                            md5sum = 50a2bd45cd12c3808c3ee48208e2586b
-                            md5sum_1m = 00000951cab7c32e332362fc424c1054
+                            md5sum_cd1 = 50a2bd45cd12c3808c3ee48208e2586b
+                            md5sum_1m_cd1 = 00000951cab7c32e332362fc424c1054
 
 
                     - 11.1.32:
@@ -1248,8 +1248,8 @@ variants:
                             boot_path = boot/i386/loader
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/SLES-11-SP1-DVD-i586-GM-DVD1.iso
-                            md5sum = 0dd6886858d93501c38854552b9b1b0d
-                            md5sum_1m = a626a3d50813410e3ac42794e05773bb
+                            md5sum_cd1 = 0dd6886858d93501c38854552b9b1b0d
+                            md5sum_1m_cd1 = a626a3d50813410e3ac42794e05773bb
 
                     - 11.1.64:
                         image_name = sles11sp1-64
@@ -1262,8 +1262,8 @@ variants:
                             boot_path = boot/x86_64/loader
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/SLES-11-SP1-DVD-x86_64-GM-DVD1.iso
-                            md5sum = d2e10420f3689faa49a004b60fb396b7
-                            md5sum_1m = f7f67b5da46923a9f01da8a2b6909654
+                            md5sum_cd1 = d2e10420f3689faa49a004b60fb396b7
+                            md5sum_1m_cd1 = f7f67b5da46923a9f01da8a2b6909654
 
 
             - @Ubuntu:
@@ -1275,8 +1275,8 @@ variants:
                         image_name = ubuntu-6.10-32
                         steps = Ubuntu-6.10-32.steps
                         cdrom_cd1 = isos/linux/ubuntu-6.10-desktop-i386.iso
-                        md5sum = 17fb825641571ce5888a718329efd016
-                        md5sum_1m = 7531d0a84e7451d17c5d976f1c3f8509
+                        md5sum_cd1 = 17fb825641571ce5888a718329efd016
+                        md5sum_1m_cd1 = 7531d0a84e7451d17c5d976f1c3f8509
 
                     - Ubuntu-8.04-32:
                         skip = yes
@@ -1292,8 +1292,8 @@ variants:
                         install:
                             steps = Ubuntu-8.10-server-32.steps
                             cdrom_cd1 = isos/linux/ubuntu-8.10-server-i386.iso
-                            md5sum = a2ec9975a91e1228c8292ed9799dc302
-                            md5sum_1m = ea493eb8ef7722ead693492fd9f8a13f
+                            md5sum_cd1 = a2ec9975a91e1228c8292ed9799dc302
+                            md5sum_1m_cd1 = ea493eb8ef7722ead693492fd9f8a13f
                         setup:
                             steps = Ubuntu-8.10-server-32-gcc.steps
 
@@ -1319,8 +1319,8 @@ variants:
                         install:
                             steps=RHEL-3.9-i386.steps
                             cdrom_cd1 = isos/linux/RHEL-3.9-i386-DVD.iso
-                            md5sum = ddd11a1cb104119039b0fa05df6d52b8
-                            md5sum_1m = 5f10c9417c7b8372b3456c1b5f3f9ed0
+                            md5sum_cd1 = ddd11a1cb104119039b0fa05df6d52b8
+                            md5sum_1m_cd1 = 5f10c9417c7b8372b3456c1b5f3f9ed0
                         unattended_install:
                             unattended_file = unattended/RHEL-3-series.ks
                             #floppy = images/rhel39-32/ks.vfd
@@ -1329,8 +1329,8 @@ variants:
                             initrd = images/rhel39-32/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/RHEL-3.9-i386-DVD.iso
-                            md5sum = ddd11a1cb104119039b0fa05df6d52b8
-                            md5sum_1m = 5f10c9417c7b8372b3456c1b5f3f9ed0
+                            md5sum_cd1 = ddd11a1cb104119039b0fa05df6d52b8
+                            md5sum_1m_cd1 = 5f10c9417c7b8372b3456c1b5f3f9ed0
 
                     - 3.9.x86_64:
                         no setup autotest linux_s3 guest_s4 shutdown
@@ -1339,8 +1339,8 @@ variants:
                         install:
                             steps=RHEL-3.9-x86_64.steps
                             cdrom_cd1 = isos/linux/RHEL-3.9-x86_64-DVD.iso
-                            md5sum = bf4635e4a4bd3b43838e72bc8c329d55
-                            md5sum_1m = 18ecd37b639109f1b2af05cfb57dfeaf
+                            md5sum_cd1 = bf4635e4a4bd3b43838e72bc8c329d55
+                            md5sum_1m_cd1 = 18ecd37b639109f1b2af05cfb57dfeaf
                         unattended_install:
                             unattended_file = unattended/RHEL-3-series.ks
                             #floppy = images/rhel39-64/ks.vfd
@@ -1349,8 +1349,8 @@ variants:
                             initrd = images/rhel39-64/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/RHEL-3.9-x86_64-DVD.iso
-                            md5sum = bf4635e4a4bd3b43838e72bc8c329d55
-                            md5sum_1m = 18ecd37b639109f1b2af05cfb57dfeaf
+                            md5sum_cd1 = bf4635e4a4bd3b43838e72bc8c329d55
+                            md5sum_1m_cd1 = 18ecd37b639109f1b2af05cfb57dfeaf
 
 
                     - 4.7.i386:
@@ -1359,8 +1359,8 @@ variants:
                         install:
                             steps = RHEL-4.7-i386.steps
                             cdrom_cd1 = isos/linux/RHEL-4.7-i386-DVD.iso
-                            md5sum = ee5092653732a88ddbaf8eef2484c500
-                            md5sum_1m = 127081cbed825d7232331a2083975528
+                            md5sum_cd1 = ee5092653732a88ddbaf8eef2484c500
+                            md5sum_1m_cd1 = 127081cbed825d7232331a2083975528
                         unattended_install:
                             unattended_file = unattended/RHEL-4-series.ks
                             #floppy = images/rhel47-32/ks.vfd
@@ -1369,8 +1369,8 @@ variants:
                             initrd = images/rhel47-32/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/RHEL-4.7-i386-DVD.iso
-                            md5sum = ee5092653732a88ddbaf8eef2484c500
-                            md5sum_1m = 127081cbed825d7232331a2083975528
+                            md5sum_cd1 = ee5092653732a88ddbaf8eef2484c500
+                            md5sum_1m_cd1 = 127081cbed825d7232331a2083975528
 
                     - 4.7.x86_64:
                         no setup autotest
@@ -1378,8 +1378,8 @@ variants:
                         install:
                             steps = RHEL-4.7-x86_64.steps
                             cdrom_cd1 = isos/linux/RHEL-4.7-x86_64-DVD.iso
-                            md5sum = ea9dae16dd86f7d94092d0e672333292
-                            md5sum_1m = 58fa63eaee68e269f4cb1d2edf479792
+                            md5sum_cd1 = ea9dae16dd86f7d94092d0e672333292
+                            md5sum_1m_cd1 = 58fa63eaee68e269f4cb1d2edf479792
                         unattended_install:
                             unattended_file = unattended/RHEL-4-series.ks
                             #floppy = images/rhel47-64/ks.vfd
@@ -1388,8 +1388,8 @@ variants:
                             initrd = images/rhel47-64/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/RHEL-4.7-x86_64-DVD.iso
-                            md5sum = ea9dae16dd86f7d94092d0e672333292
-                            md5sum_1m = 58fa63eaee68e269f4cb1d2edf479792
+                            md5sum_cd1 = ea9dae16dd86f7d94092d0e672333292
+                            md5sum_1m_cd1 = 58fa63eaee68e269f4cb1d2edf479792
 
                     - 4.8.i386:
                         no setup autotest
@@ -1402,8 +1402,8 @@ variants:
                             initrd = images/rhel48-32/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/RHEL-4.8-i386-DVD.iso
-                            md5sum = b024f0af5079539d3ef51f71fed0b194
-                            md5sum_1m = 969c197402b9058f28a278c1f807d15b
+                            md5sum_cd1 = b024f0af5079539d3ef51f71fed0b194
+                            md5sum_1m_cd1 = 969c197402b9058f28a278c1f807d15b
 
 
                     - 4.8.x86_64:
@@ -1417,8 +1417,8 @@ variants:
                             initrd = images/rhel48-64/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/RHEL-4.8-x86_64-DVD.iso
-                            md5sum = 696bc877b0200cc942626673fcc3fc09
-                            md5sum_1m = b11ac0ef7fd345ad712966972db63886
+                            md5sum_cd1 = 696bc877b0200cc942626673fcc3fc09
+                            md5sum_1m_cd1 = b11ac0ef7fd345ad712966972db63886
 
 
                     - 5.3.i386:
@@ -1427,8 +1427,8 @@ variants:
                         install:
                             steps = RHEL-5.3-i386.steps
                             cdrom_cd1 = isos/linux/RHEL-5.3-i386-DVD.iso
-                            md5sum = 371c62851611fd32ead440df6f24a296
-                            md5sum_1m = 242318dd44152210f6ff6cdda1bfbf51
+                            md5sum_cd1 = 371c62851611fd32ead440df6f24a296
+                            md5sum_1m_cd1 = 242318dd44152210f6ff6cdda1bfbf51
                         unattended_install:
                             unattended_file = unattended/RHEL-5-series.ks
                             #floppy = images/rhel53-32/ks.vfd
@@ -1437,8 +1437,8 @@ variants:
                             initrd = images/rhel53-32/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/RHEL-5.3-i386-DVD.iso
-                            md5sum = 371c62851611fd32ead440df6f24a296
-                            md5sum_1m = 242318dd44152210f6ff6cdda1bfbf51
+                            md5sum_cd1 = 371c62851611fd32ead440df6f24a296
+                            md5sum_1m_cd1 = 242318dd44152210f6ff6cdda1bfbf51
 
 
                     - 5.3.x86_64:
@@ -1447,8 +1447,8 @@ variants:
                         install:
                             steps=RHEL-5.3-x86_64.steps
                             cdrom_cd1 = isos/linux/RHEL-5.3-x86_64-DVD.iso
-                            md5sum = c5ed6b284410f4d8212cafc78fd7a8c5
-                            md5sum_1m = b999f437583098ea5bbd56fb1de1d011
+                            md5sum_cd1 = c5ed6b284410f4d8212cafc78fd7a8c5
+                            md5sum_1m_cd1 = b999f437583098ea5bbd56fb1de1d011
                         unattended_install:
                             unattended_file = unattended/RHEL-5-series.ks
                             #floppy = images/rhel53-64/ks.vfd
@@ -1457,8 +1457,8 @@ variants:
                             initrd = images/rhel53-64/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/RHEL-5.3-x86_64-DVD.iso
-                            md5sum = c5ed6b284410f4d8212cafc78fd7a8c5
-                            md5sum_1m = b999f437583098ea5bbd56fb1de1d011
+                            md5sum_cd1 = c5ed6b284410f4d8212cafc78fd7a8c5
+                            md5sum_1m_cd1 = b999f437583098ea5bbd56fb1de1d011
 
 
                     - 5.4.i386:
@@ -1472,8 +1472,8 @@ variants:
                             initrd = images/rhel54-32/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/RHEL-5.4-i386-DVD.iso
-                            md5sum = 7a12ec6599527e4f3d1790b51eadbfed
-                            md5sum_1m = 0dbeb8f58d213752d8c029e8601abfbb
+                            md5sum_cd1 = 7a12ec6599527e4f3d1790b51eadbfed
+                            md5sum_1m_cd1 = 0dbeb8f58d213752d8c029e8601abfbb
 
 
                     - 5.4.x86_64:
@@ -1487,8 +1487,8 @@ variants:
                             initrd = images/rhel54-64/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/RHEL-5.4-x86_64-DVD.iso
-                            md5sum = 04fe3c10202402d7b389528d2bad0210
-                            md5sum_1m = 3e74112003e88a966754849dbb8f5c3f
+                            md5sum_cd1 = 04fe3c10202402d7b389528d2bad0210
+                            md5sum_1m_cd1 = 3e74112003e88a966754849dbb8f5c3f
 
 
                     - 5.5.i386:
@@ -1502,8 +1502,8 @@ variants:
                             initrd = images/rhel55-32/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/RHEL-5.5-i386-DVD.iso
-                            md5sum = 148858b157f275d9153797efddfc83c3
-                            md5sum_1m = 2502cc7ddb9d0684fe08c4a83d247902
+                            md5sum_cd1 = 148858b157f275d9153797efddfc83c3
+                            md5sum_1m_cd1 = 2502cc7ddb9d0684fe08c4a83d247902
 
 
                     - 5.5.x86_64:
@@ -1517,8 +1517,8 @@ variants:
                             initrd = images/rhel55-64/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/RHEL-5.5-x86_64-DVD.iso
-                            md5sum = f3119f883257ef9041234feda2f1cad0
-                            md5sum_1m = a744084a03f6a08627f71527fc107a1e
+                            md5sum_cd1 = f3119f883257ef9041234feda2f1cad0
+                            md5sum_1m_cd1 = a744084a03f6a08627f71527fc107a1e
 
 
                     - 6.0.i386:
@@ -1532,8 +1532,8 @@ variants:
                             initrd = images/rhel60-32/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/RHEL-6.0-i386-DVD.iso
-                            md5sum = 291d234c93442405972689b4b41c14bc
-                            md5sum_1m = ee2cc3d3babe91a1d581a07099c4318b
+                            md5sum_cd1 = 291d234c93442405972689b4b41c14bc
+                            md5sum_1m_cd1 = ee2cc3d3babe91a1d581a07099c4318b
 
 
                     - 6.0.x86_64:
@@ -1547,8 +1547,8 @@ variants:
                             initrd = images/rhel60-64/initrd.img
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/linux/RHEL-6.0-x86_64-DVD.iso
-                            md5sum = f7141396c6a19399d63e8c195354317d
-                            md5sum_1m = b060eeef63e2c8700db54ae02056e80c
+                            md5sum_cd1 = f7141396c6a19399d63e8c195354317d
+                            md5sum_1m_cd1 = b060eeef63e2c8700db54ae02056e80c
 
 
 
@@ -1664,15 +1664,15 @@ variants:
                 install:
                     steps = Win2000-32.steps
                     cdrom_cd1 = isos/windows/Windows2000_sp4.iso
-                    md5sum = dda6039f3a9173f0f6bfae40f5efdfea
-                    md5sum_1m = dd28fba196d366d56fe774bd93df5527
+                    md5sum_cd1 = dda6039f3a9173f0f6bfae40f5efdfea
+                    md5sum_1m_cd1 = dd28fba196d366d56fe774bd93df5527
                     user = user
                 setup:
                     steps = Win2000-32-rss.steps
                 unattended_install.cdrom:
                     cdrom_cd1 = isos/windows/Windows2000_sp4.iso
-                    md5sum = dda6039f3a9173f0f6bfae40f5efdfea
-                    md5sum_1m = dd28fba196d366d56fe774bd93df5527
+                    md5sum_cd1 = dda6039f3a9173f0f6bfae40f5efdfea
+                    md5sum_1m_cd1 = dd28fba196d366d56fe774bd93df5527
                     unattended_file = unattended/win2000-32.sif
                     floppy = images/win2000-32/answer.vfd
 
@@ -1683,16 +1683,16 @@ variants:
                         image_name += -32
                         install:
                             cdrom_cd1 = isos/windows/WindowsXP-sp2-vlk.iso
-                            md5sum = 743450644b1d9fe97b3cf379e22dceb0
-                            md5sum_1m = b473bf75af2d1269fec8958cf0202bfd
+                            md5sum_cd1 = 743450644b1d9fe97b3cf379e22dceb0
+                            md5sum_1m_cd1 = b473bf75af2d1269fec8958cf0202bfd
                             user = user
                             steps = WinXP-32.steps
                         setup:
                             steps = WinXP-32-rss.steps
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/windows/WindowsXP-sp2-vlk.iso
-                            md5sum = 743450644b1d9fe97b3cf379e22dceb0
-                            md5sum_1m = b473bf75af2d1269fec8958cf0202bfd
+                            md5sum_cd1 = 743450644b1d9fe97b3cf379e22dceb0
+                            md5sum_1m_cd1 = b473bf75af2d1269fec8958cf0202bfd
                             unattended_file = unattended/winxp32.sif
                             floppy = images/winXP-32/answer.vfd
                             # Uncomment virtio_network_installer_path line if
@@ -1713,16 +1713,16 @@ variants:
                         image_name += -64
                         install:
                             cdrom_cd1 = isos/windows/WindowsXP-64.iso
-                            md5sum = 8d3f007ec9c2060cec8a50ee7d7dc512
-                            md5sum_1m = e812363ff427effc512b7801ee70e513
+                            md5sum_cd1 = 8d3f007ec9c2060cec8a50ee7d7dc512
+                            md5sum_1m_cd1 = e812363ff427effc512b7801ee70e513
                             user = user
                             steps = WinXP-64.steps
                         setup:
                             steps = WinXP-64-rss.steps
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/windows/WindowsXP-64.iso
-                            md5sum = 8d3f007ec9c2060cec8a50ee7d7dc512
-                            md5sum_1m = e812363ff427effc512b7801ee70e513
+                            md5sum_cd1 = 8d3f007ec9c2060cec8a50ee7d7dc512
+                            md5sum_1m_cd1 = e812363ff427effc512b7801ee70e513
                             unattended_file = unattended/winxp64.sif
                             floppy = images/winXP-64/answer.vfd
                             # Uncomment virtio_network_installer_path line if
@@ -1748,16 +1748,16 @@ variants:
                         image_name += -32
                         install:
                             cdrom_cd1 = isos/windows/Windows2003_r2_VLK.iso
-                            md5sum = 03e921e9b4214773c21a39f5c3f42ef7
-                            md5sum_1m = 37c2fdec15ac4ec16aa10fdfdb338aa3
+                            md5sum_cd1 = 03e921e9b4214773c21a39f5c3f42ef7
+                            md5sum_1m_cd1 = 37c2fdec15ac4ec16aa10fdfdb338aa3
                             user = user
                             steps = Win2003-32.steps
                         setup:
                             steps = Win2003-32-rss.steps
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/windows/Windows2003_r2_VLK.iso
-                            md5sum = 03e921e9b4214773c21a39f5c3f42ef7
-                            md5sum_1m = 37c2fdec15ac4ec16aa10fdfdb338aa3
+                            md5sum_cd1 = 03e921e9b4214773c21a39f5c3f42ef7
+                            md5sum_1m_cd1 = 37c2fdec15ac4ec16aa10fdfdb338aa3
                             unattended_file = unattended/win2003-32.sif
                             floppy = images/win2003-32/answer.vfd
                             # Uncomment virtio_network_installer_path line if
@@ -1777,16 +1777,16 @@ variants:
                         image_name += -64
                         install:
                             cdrom_cd1 = isos/windows/Windows2003-x64.iso
-                            md5sum = 5703f87c9fd77d28c05ffadd3354dbbd
-                            md5sum_1m = 439393c384116aa09e08a0ad047dcea8
+                            md5sum_cd1 = 5703f87c9fd77d28c05ffadd3354dbbd
+                            md5sum_1m_cd1 = 439393c384116aa09e08a0ad047dcea8
                             user = user
                             steps = Win2003-64.steps
                         setup:
                             steps = Win2003-64-rss.steps
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/windows/Windows2003-x64.iso
-                            md5sum = 5703f87c9fd77d28c05ffadd3354dbbd
-                            md5sum_1m = 439393c384116aa09e08a0ad047dcea8
+                            md5sum_cd1 = 5703f87c9fd77d28c05ffadd3354dbbd
+                            md5sum_1m_cd1 = 439393c384116aa09e08a0ad047dcea8
                             unattended_file = unattended/win2003-64.sif
                             floppy = images/win2003-64/answer.vfd
                             # Uncomment virtio_network_installer_path line if
@@ -1823,15 +1823,15 @@ variants:
                                 image_name += -sp1-32
                                 install:
                                     cdrom_cd1 = isos/windows/WindowsVista-32.iso
-                                    md5sum = 1008f323d5170c8e614e52ccb85c0491
-                                    md5sum_1m = c724e9695da483bc0fd59e426eaefc72
+                                    md5sum_cd1 = 1008f323d5170c8e614e52ccb85c0491
+                                    md5sum_1m_cd1 = c724e9695da483bc0fd59e426eaefc72
                                     steps = Win-Vista-32.steps
                                 setup:
                                     steps = WinVista-32-rss.steps
                                 unattended_install.cdrom:
                                     cdrom_cd1 = isos/windows/WindowsVista-32.iso
-                                    md5sum = 1008f323d5170c8e614e52ccb85c0491
-                                    md5sum_1m = c724e9695da483bc0fd59e426eaefc72
+                                    md5sum_cd1 = 1008f323d5170c8e614e52ccb85c0491
+                                    md5sum_1m_cd1 = c724e9695da483bc0fd59e426eaefc72
                                     unattended_file = unattended/winvista-32-autounattend.xml
                                     floppy = images/winvista-sp1-32/answer.vfd
                                     # Uncomment virtio_network_installer_path line if
@@ -1845,10 +1845,10 @@ variants:
                                 image_name += -sp2-32
                                 unattended_install.cdrom:
                                     cdrom_cd1 = isos/windows/en_windows_vista_with_sp2_x86_dvd_342266.iso
-                                    md5sum = 19ca90a425667812977bab6f4ce24175
-                                    md5sum_1m = 89c15020e0e6125be19acf7a2e5dc614
-                                    sha1sum = 25ad9a776503e6a583bec07879dbcc5dfd20cd6e
-                                    sha1sum_1m = a2afa4cffdc1c362dbf9e62942337f4f875a22cf
+                                    md5sum_cd1 = 19ca90a425667812977bab6f4ce24175
+                                    md5sum_1m_cd1 = 89c15020e0e6125be19acf7a2e5dc614
+                                    sha1sum_cd1 = 25ad9a776503e6a583bec07879dbcc5dfd20cd6e
+                                    sha1sum_1m_cd1 = a2afa4cffdc1c362dbf9e62942337f4f875a22cf
                                     unattended_file = unattended/winvista-32-autounattend.xml
                                     floppy = images/winvista-sp2-32/answer.vfd
                                     # Uncomment virtio_network_installer_path line if
@@ -1869,15 +1869,15 @@ variants:
                                 image_name += -sp1-64
                                 install:
                                     cdrom_cd1 = isos/windows/WindowsVista-64.iso
-                                    md5sum = 11e2010d857fffc47813295e6be6d58d
-                                    md5sum_1m = 0947bcd5390546139e25f25217d6f165
+                                    md5sum_cd1 = 11e2010d857fffc47813295e6be6d58d
+                                    md5sum_1m_cd1 = 0947bcd5390546139e25f25217d6f165
                                     steps = Win-Vista-64.steps
                                 setup:
                                     steps = WinVista-64-rss.steps
                                 unattended_install.cdrom:
                                     cdrom_cd1 = isos/windows/WindowsVista-64.iso
-                                    md5sum = 11e2010d857fffc47813295e6be6d58d
-                                    md5sum_1m = 0947bcd5390546139e25f25217d6f165
+                                    md5sum_cd1 = 11e2010d857fffc47813295e6be6d58d
+                                    md5sum_1m_cd1 = 0947bcd5390546139e25f25217d6f165
                                     unattended_file = unattended/winvista-64-autounattend.xml
                                     floppy = images/winvista-sp1-64/answer.vfd
                                     # Uncomment virtio_network_installer_path line if
@@ -1890,10 +1890,10 @@ variants:
                                 image_name += -sp2-64
                                 unattended_install.cdrom:
                                     cdrom_cd1 = isos/windows/en_windows_vista_sp2_x64_dvd_342267.iso
-                                    md5sum = a1c024d7abaf34bac3368e88efbc2574
-                                    md5sum_1m = 3d84911a80f3df71d1026f7adedc2181
-                                    sha1sum = aaee3c04533899f9f8c4ae0c4250ef5fafbe29a3
-                                    sha1sum_1m = 1fd21bd3ce2a4de8856c7b8fe6fdf80260f6d1c7
+                                    md5sum_cd1 = a1c024d7abaf34bac3368e88efbc2574
+                                    md5sum_1m_cd1 = 3d84911a80f3df71d1026f7adedc2181
+                                    sha1sum_cd1 = aaee3c04533899f9f8c4ae0c4250ef5fafbe29a3
+                                    sha1sum_1m_cd1 = 1fd21bd3ce2a4de8856c7b8fe6fdf80260f6d1c7
                                     unattended_file = unattended/winvista-64-autounattend.xml
                                     floppy = images/winvista-sp2-64/answer.vfd
                                     # Uncomment virtio_network_installer_path line if
@@ -1918,7 +1918,7 @@ variants:
                                     #en_windows_server_2008_datacenter_enterprise_standard_x86_dvd_X14-26710.iso
                                     md5sum=0bfca49f0164de0a8eba236ced47007d
                                     md5sum_1m=07d7f5006393f74dc76e6e2e943e2440
-                                    sha1sum = 6ca018ff96f1e9b2b310a36546b6fded99a421e6
+                                    sha1sum_cd1 = 6ca018ff96f1e9b2b310a36546b6fded99a421e6
                                     steps = Win2008-32.steps
                                 setup:
                                     steps = Win2008-32-rss.steps
@@ -1939,10 +1939,10 @@ variants:
                                 image_name += -sp2-32
                                 unattended_install.cdrom:
                                     cdrom_cd1 = isos/windows/en_windows_server_2008_datacenter_enterprise_standard_sp2_x86_dvd_342333.iso
-                                    md5sum = b9201aeb6eef04a3c573d036a8780bdf
-                                    md5sum_1m = b7a9d42e55ea1e85105a3a6ad4da8e04
-                                    sha1sum = 49d0d6917c1256fe81048d414fa473bbc76a8724
-                                    sha1sum_1m = 9662ff7ed715faa00407e4befc484ea52a92a9fb
+                                    md5sum_cd1 = b9201aeb6eef04a3c573d036a8780bdf
+                                    md5sum_1m_cd1 = b7a9d42e55ea1e85105a3a6ad4da8e04
+                                    sha1sum_cd1 = 49d0d6917c1256fe81048d414fa473bbc76a8724
+                                    sha1sum_1m_cd1 = 9662ff7ed715faa00407e4befc484ea52a92a9fb
                                     unattended_file = unattended/win2008-32-autounattend.xml
                                     floppy = images/win2008-sp2-32/answer.vfd
                                     # Uncomment virtio_network_installer_path line if
@@ -1962,7 +1962,7 @@ variants:
                                     #en_windows_server_2008_datacenter_enterprise_standard_x64_dvd_X14-26714.iso
                                     md5sum=27c58cdb3d620f28c36333a5552f271c
                                     md5sum_1m=efdcc11d485a1ef9afa739cb8e0ca766
-                                    sha1sum = bd000374709f67e9358814db6ec8f0ddaaa16f70
+                                    sha1sum_cd1 = bd000374709f67e9358814db6ec8f0ddaaa16f70
                                     passwd = 1q2w3eP
                                 setup:
                                     steps = Win2008-64-rss.steps
@@ -1983,10 +1983,10 @@ variants:
                                 image_name += -sp2-64
                                 unattended_install.cdrom:
                                     cdrom_cd1 = isos/windows/en_windows_server_2008_datacenter_enterprise_standard_sp2_x64_dvd_342336.iso
-                                    md5sum = e94943ef484035b3288d8db69599a6b5
-                                    md5sum_1m = ee55506823d0efffb5532ddd88a8e47b
-                                    sha1sum = 34c7d726c57b0f8b19ba3b40d1b4044c15fc2029
-                                    sha1sum_1m = 8fe08b03e3531906855a60a78020ac9577dff5ba
+                                    md5sum_cd1 = e94943ef484035b3288d8db69599a6b5
+                                    md5sum_1m_cd1 = ee55506823d0efffb5532ddd88a8e47b
+                                    sha1sum_cd1 = 34c7d726c57b0f8b19ba3b40d1b4044c15fc2029
+                                    sha1sum_1m_cd1 = 8fe08b03e3531906855a60a78020ac9577dff5ba
                                     unattended_file = unattended/win2008-64-autounattend.xml
                                     floppy = images/win2008-sp2-64/answer.vfd
                                     # Uncomment virtio_network_installer_path line if
@@ -2000,10 +2000,10 @@ variants:
                                 image_name += -r2-64
                                 unattended_install.cdrom:
                                     cdrom_cd1 = isos/windows/en_windows_server_2008_r2_standard_enterprise_datacenter_and_web_x64_dvd_x15-59754.iso
-                                    md5sum = 0207ef392c60efdda92071b0559ca0f9
-                                    md5sum_1m = a5a22ce25008bd7109f6d830d627e3ed
-                                    sha1sum = ad855ea913aaec3f1d0e1833c1aef7a0de326b0a
-                                    sha1sum_1m = 9194a3aabae25b36e5f73cad001314b2c8d07d14
+                                    md5sum_cd1 = 0207ef392c60efdda92071b0559ca0f9
+                                    md5sum_1m_cd1 = a5a22ce25008bd7109f6d830d627e3ed
+                                    sha1sum_cd1 = ad855ea913aaec3f1d0e1833c1aef7a0de326b0a
+                                    sha1sum_1m_cd1 = 9194a3aabae25b36e5f73cad001314b2c8d07d14
                                     unattended_file = unattended/win2008-r2-autounattend.xml
                                     floppy = images/win2008-r2-64/answer.vfd
                                     # Uncomment virtio_network_installer_path line if
@@ -2028,10 +2028,10 @@ variants:
                         image_name += -32
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/windows/en_windows_7_ultimate_x86_dvd_x15-65921.iso
-                            md5sum = d0b8b407e8a3d4b75ee9c10147266b89
-                            md5sum_1m = 2b0c2c22b1ae95065db08686bf83af93
-                            sha1sum = 5395dc4b38f7bdb1e005ff414deedfdb16dbf610
-                            sha1sum_1m = 9f9c3780aebeb28a9bf22188eed6bc15475dc9c5
+                            md5sum_cd1 = d0b8b407e8a3d4b75ee9c10147266b89
+                            md5sum_1m_cd1 = 2b0c2c22b1ae95065db08686bf83af93
+                            sha1sum_cd1 = 5395dc4b38f7bdb1e005ff414deedfdb16dbf610
+                            sha1sum_1m_cd1 = 9f9c3780aebeb28a9bf22188eed6bc15475dc9c5
                             unattended_file = unattended/win7-32-autounattend.xml
                             floppy = images/win7-32/answer.vfd
                             # Uncomment virtio_network_installer_path line if
@@ -2058,10 +2058,10 @@ variants:
                             steps = Win7-64-rss.steps
                         unattended_install.cdrom:
                             cdrom_cd1 = isos/windows/en_windows_7_ultimate_x64_dvd_x15-65922.iso
-                            md5sum = f43d22e4fb07bf617d573acd8785c028
-                            md5sum_1m = b44d8cf99dbed2a5cb02765db8dfd48f
-                            sha1sum = 326327cc2ff9f05379f5058c41be6bc5e004baa7
-                            sha1sum_1m = 4a3903bd5157de54f0702e5263e0a683c5775515
+                            md5sum_cd1 = f43d22e4fb07bf617d573acd8785c028
+                            md5sum_1m_cd1 = b44d8cf99dbed2a5cb02765db8dfd48f
+                            sha1sum_cd1 = 326327cc2ff9f05379f5058c41be6bc5e004baa7
+                            sha1sum_1m_cd1 = 4a3903bd5157de54f0702e5263e0a683c5775515
                             unattended_file = unattended/win7-64-autounattend.xml
                             floppy = images/win7-64/answer.vfd
                             # Uncomment virtio_network_installer_path line if
@@ -2097,8 +2097,8 @@ variants:
                 image_name = OpenBSD-4.1
                 steps = OpenBSD-4.1-32.steps
                 cdrom_cd1 = isos/unix/openbsd41-i386-07-05-06.iso
-                md5sum = 984790db10ebdd6fc7a9cf97abc7c967
-                md5sum_1m = 8fc234b4b0ecfe56843a32ac1d26ed55
+                md5sum_cd1 = 984790db10ebdd6fc7a9cf97abc7c967
+                md5sum_1m_cd1 = 8fc234b4b0ecfe56843a32ac1d26ed55
 
     # Live CD section
     - @livecd:
@@ -2111,26 +2111,26 @@ variants:
             - Belenix:
                 steps = Belenix-0.7.1.steps
                 cdrom_cd1 = isos/unix/belenix_0.7.1.iso
-                md5sum = 29cea6160cf5250de138e2820e53e342
-                md5sum_1m = 427bbef1b85d6d051799b825d686ae94
+                md5sum_cd1 = 29cea6160cf5250de138e2820e53e342
+                md5sum_1m_cd1 = 427bbef1b85d6d051799b825d686ae94
 
             - Slax:
                 steps = Slax-6.0.7.steps
                 cdrom_cd1 = isos/linux/slax-6.0.7.iso
-                md5sum = cde0ecba3c8289d786e12c44666ded6e
-                md5sum_1m = ddf02bc7444f22d1160a6e5a8fc8723f
+                md5sum_cd1 = cde0ecba3c8289d786e12c44666ded6e
+                md5sum_1m_cd1 = ddf02bc7444f22d1160a6e5a8fc8723f
 
             - FreeSBIE-2.0.1:
                 steps = FreeSBIE-2.0.1.steps
                 cdrom_cd1 = isos/unix/FreeSBIE-2.0.1-RELEASE.iso
-                md5sum = b2f680d27c21bbfaf4fb90dce090a118
-                md5sum_1m = 4d81ee7fe0101b0a14225963bfff60c1
+                md5sum_cd1 = b2f680d27c21bbfaf4fb90dce090a118
+                md5sum_1m_cd1 = 4d81ee7fe0101b0a14225963bfff60c1
 
             - memtest:
                 mem = 128
                 steps = memtest86+.steps
                 cdrom_cd1 = isos/misc/memtest86+-2.01.iso
-                md5sum = 9fae22f2666369968a76ef59e9a81ced
+                md5sum_cd1 = 9fae22f2666369968a76ef59e9a81ced
 
 
 variants:
Signature · 6 lines
1.7.3.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#23 lore raw

PATCH 15/28 KVM test: kvm_subprocess.py: increase default timeout from 30 to 60 secs

In reply to Michael Goldish
---
 client/tests/kvm/kvm_subprocess.py |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)
client/tests/kvm/kvm_subprocess.py +12 -12
index a60eaf6..c3e2dd7 100755
@@ -940,7 +940,7 @@ class Expect(Tail):
 
 
     def read_until_output_matches(self, patterns, filter=lambda x: x,
-                                  timeout=30.0, internal_timeout=None,
+                                  timeout=60, internal_timeout=None,
                                   print_func=None):
         """
         Read using read_nonblocking until a match is found using match_patterns,
@@ -997,7 +997,7 @@ class Expect(Tail):
             raise ExpectError(patterns, o)
 
 
-    def read_until_last_word_matches(self, patterns, timeout=30.0,
+    def read_until_last_word_matches(self, patterns, timeout=60,
                                      internal_timeout=None, print_func=None):
         """
         Read using read_nonblocking until the last word of the output matches
@@ -1026,7 +1026,7 @@ class Expect(Tail):
                                               print_func)
 
 
-    def read_until_last_line_matches(self, patterns, timeout=30.0,
+    def read_until_last_line_matches(self, patterns, timeout=60,
                                      internal_timeout=None, print_func=None):
         """
         Read using read_nonblocking until the last non-empty line of the output
@@ -1166,7 +1166,7 @@ class ShellSession(Expect):
         return False
 
 
-    def read_up_to_prompt(self, timeout=30.0, internal_timeout=None,
+    def read_up_to_prompt(self, timeout=60, internal_timeout=None,
                           print_func=None):
         """
         Read using read_nonblocking until the last non-empty line of the output
@@ -1193,7 +1193,7 @@ class ShellSession(Expect):
         return o
 
 
-    def cmd_output(self, cmd, timeout=30.0, internal_timeout=None,
+    def cmd_output(self, cmd, timeout=60, internal_timeout=None,
                    print_func=None):
         """
         Send a command and return its output.
@@ -1237,7 +1237,7 @@ class ShellSession(Expect):
         return remove_last_nonempty_line(remove_command_echo(o, cmd))
 
 
-    def cmd_status_output(self, cmd, timeout=30.0, internal_timeout=None,
+    def cmd_status_output(self, cmd, timeout=60, internal_timeout=None,
                           print_func=None):
         """
         Send a command and return its exit status and output.
@@ -1272,7 +1272,7 @@ class ShellSession(Expect):
             raise ShellStatusError(cmd, o)
 
 
-    def cmd_status(self, cmd, timeout=30.0, internal_timeout=None,
+    def cmd_status(self, cmd, timeout=60, internal_timeout=None,
                    print_func=None):
         """
         Send a command and return its exit status.
@@ -1296,7 +1296,7 @@ class ShellSession(Expect):
         return s
 
 
-    def cmd(self, cmd, timeout=30.0, internal_timeout=None, print_func=None):
+    def cmd(self, cmd, timeout=60, internal_timeout=None, print_func=None):
         """
         Send a command and return its output. If the command's exit status is
         nonzero, raise an exception.
@@ -1325,7 +1325,7 @@ class ShellSession(Expect):
         return o
 
 
-    def get_command_output(self, cmd, timeout=30.0, internal_timeout=None,
+    def get_command_output(self, cmd, timeout=60, internal_timeout=None,
                            print_func=None):
         """
         Alias for cmd_output() for backward compatibility.
@@ -1333,8 +1333,8 @@ class ShellSession(Expect):
         return self.cmd_output(cmd, timeout, internal_timeout, print_func)
 
 
-    def get_command_status_output(self, cmd, timeout=30.0,
-                                  internal_timeout=None, print_func=None):
+    def get_command_status_output(self, cmd, timeout=60, internal_timeout=None,
+                                  print_func=None):
         """
         Alias for cmd_status_output() for backward compatibility.
         """
@@ -1342,7 +1342,7 @@ class ShellSession(Expect):
                                       print_func)
 
 
-    def get_command_status(self, cmd, timeout=30.0, internal_timeout=None,
+    def get_command_status(self, cmd, timeout=60, internal_timeout=None,
                            print_func=None):
         """
         Alias for cmd_status() for backward compatibility.
Signature · 1 line
1.7.3.3
#24 lore raw

PATCH 16/28 KVM test: whql_submission: run a user specified shell command before the test

In reply to Michael Goldish
---
 client/tests/kvm/tests/whql_submission.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
client/tests/kvm/tests/whql_submission.py +5 -0
index b1b7f25..8dd48b8 100644
@@ -42,6 +42,11 @@ def run_whql_submission(test, params, env):
     for svc in wtt_services.split():
         kvm_test_utils.start_windows_service(session, svc)
 
+    # Run whql_pre_command
+    if params.get("whql_pre_command"):
+        session.cmd(params.get("whql_pre_command"),
+                    int(params.get("whql_pre_command_timeout", 600)))
+
     # Copy dsso_test_binary to the server
     rss_file_transfer.upload(server_address, server_file_transfer_port,
                              dsso_test_binary, server_studio_path, timeout=60)
Signature · 1 line
1.7.3.3
#25 lore raw

PATCH 17/28 KVM test: whql_submission: make the HDD tests run on a non-system drive

In reply to Michael Goldish

One of the tests refuses to run on a system drive, so:
- Add a 2nd disk to the qemu command line and create a 4G image for it
- Partition the 2nd disk and assign D: to it before running the tests
- Tell the tests to run on a non-system drive

---
 client/tests/kvm/tests_base.cfg.sample |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
client/tests/kvm/tests_base.cfg.sample +14 -1
index ff02a72..147d89a 100644
@@ -397,7 +397,9 @@ variants:
                         dd_data_prog = InputKbd
                         dd_data_desc = Input > Keyboard
                     - hdd:
-                        test_device = qemu harddisk
+                        # Run the tests on a non-system drive
+                        # (match devices that contain 'QEMU HARDDISK' and do not contain '[C]')
+                        test_device = ^(?=.*?\bQEMU HARDDISK\b)((?!\[C\]).)*$
                         device_data += " ex0 ex1 ex2 ex3"
                         dd_data_cat0 = Storage\Device Class\Disk\Disk
                         dd_data_cat1 = Storage\Device Class\Disk\Fixed
@@ -413,6 +415,17 @@ variants:
                         dd_data_ex2 = 0
                         dd_name_ex3 = Secure_Storage
                         dd_data_ex3 = 0
+                        # Add a 2nd disk which will become D:
+                        images += " tmp"
+                        image_name_tmp = tmp
+                        image_size_tmp = 4G
+                        force_create_image_tmp = yes
+                        # Run diskpart to partition the 2nd disk
+                        whql_pre_command = "echo select disk=1 > dp.txt && "
+                        whql_pre_command += "echo create partition primary >> dp.txt && "
+                        whql_pre_command += "echo assign letter=d >> dp.txt && "
+                        whql_pre_command += "diskpart /s dp.txt & "
+                        whql_pre_command += "format d: /fs:ntfs /q /y"
                         variants:
                             - full:
                                 # Yes, 100 hours, this is not a mistake
Signature · 1 line
1.7.3.3
#26 lore raw

PATCH 18/28 KVM test: whql: rename the whql_submission variant to whql.submission

In reply to Michael Goldish

Rename whql_submission to whql.submission and whql_client_install to whql.client_install.

---
 client/tests/kvm/tests_base.cfg.sample |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
client/tests/kvm/tests_base.cfg.sample +13 -13
index 147d89a..b2419b0 100644
@@ -337,7 +337,7 @@ variants:
         iozone_cmd = "D:\IOzone\iozone.exe -a"
         iozone_timeout = 3600
 
-    - @whql:         install setup unattended_install.cdrom
+    - whql:         install setup unattended_install.cdrom
         nic_mode = tap
         # Replace this with the address of an installed DTM server
         server_address = 10.20.30.40
@@ -349,7 +349,7 @@ variants:
         server_studio_path = %programfiles%\Microsoft Driver Test Manager\Studio
         wtt_services = wttsvc
         variants:
-            - whql_client_install:
+            - client_install:
                 type = whql_client_install
                 dsso_delete_machine_binary = deps/whql_delete_machine_15.exe
                 # The username and password are required for accessing the DTM client
@@ -360,7 +360,7 @@ variants:
                 # (the final cmd will be something like \\servername\DTMInstall\...)
                 install_cmd = \DTMInstall\Client\Setup.exe /passive
                 install_timeout = 3600
-            - whql_submission:    whql_client_install
+            - submission:    client_install
                 type = whql_submission
                 extra_params += " -snapshot"
                 dsso_test_binary = deps/whql_submission_15.exe
@@ -1714,7 +1714,7 @@ variants:
                             virtio_oemsetup_id = WXP32
                             virtio_network_path = 'F:\NetKVM\xp\x86'
                             #virtio_network_installer_path = 'F:\RHEV-Network32.msi'
-                        whql_submission:
+                        whql.submission:
                             desc_path_desc1 = $\WDK\Logo Type\Device Logo\Windows XP
                             desc_path_desc2 = $\WDK\Logo Type\Systems Logo\Windows XP
                             dd_data_logoarch = X86
@@ -1744,7 +1744,7 @@ variants:
                             virtio_oemsetup_id = WNET64
                             virtio_network_path = 'F:\NetKVM\xp\amd64'
                             #virtio_network_installer_path = 'F:\RHEV-Network64.msi'
-                        whql_submission:
+                        whql.submission:
                             desc_path_desc1 = $\WDK\Logo Type\Device Logo\Windows XP
                             desc_path_desc2 = $\WDK\Logo Type\Systems Logo\Windows XP
                             dd_data_logoarch = AMD64
@@ -1779,7 +1779,7 @@ variants:
                             virtio_oemsetup_id = WNET32
                             virtio_network_path = 'F:\NetKVM\2k3\x86'
                             #virtio_network_installer_path = 'F:\RHEV-Network32.msi'
-                        whql_submission:
+                        whql.submission:
                             desc_path_desc1 = $\WDK\Logo Type\Device Logo\Windows Server 2003
                             dd_data_logoarch = X86
                             dd_data_logoos = Windows Server 2003
@@ -1809,7 +1809,7 @@ variants:
                             virtio_network_path = 'F:\NetKVM\2k3\amd64'
                             #virtio_network_installer_path = 'F:\RHEV-Network64.msi'
 
-                        whql_submission:
+                        whql.submission:
                             desc_path_desc1 = $\WDK\Logo Type\Device Logo\Windows Server 2003
                             dd_data_logoarch = AMD64
                             dd_data_logoos = Windows Server 2003
@@ -1819,14 +1819,14 @@ variants:
             - WinVista:
                 image_name = winvista
                 image_size = 20G
-                whql_submission:
+                whql.submission:
                     desc_path_desc1 = $\WDK\Logo Type\Device Logo\Vista Client\Device Premium
                     desc_path_desc2 = $\WDK\Logo Type\Device Logo\Vista Client\Device Standard
                     desc_path_desc3 = $\WDK\Logo Type\Device Logo\Vista Client
 
                 variants:
                     - 32:
-                        whql_submission:
+                        whql.submission:
                             dd_data_logoarch = X86
                             dd_data_logoos = Windows Vista
                             dd_data_whqlos = Windows Vista Client
@@ -1872,7 +1872,7 @@ variants:
                                     #virtio_network_installer_path = 'F:\RHEV-Network32.msi'
 
                     - 64:
-                        whql_submission:
+                        whql.submission:
                             dd_data_logoarch = AMD64
                             dd_data_logoos = Windows Vista
                             dd_data_whqlos = Windows Vista Client x64
@@ -2029,7 +2029,7 @@ variants:
             - Win7:
                 image_name = win7
                 image_size = 20G
-                whql_submission:
+                whql.submission:
                     desc_path_desc1 = $\WDK\Logo Type\Device Logo\Windows 7 Client\Logo
                     desc_path_desc2 = $\WDK\Logo Type\Device Logo\Windows 7 Client
                     device_data += " adq"
@@ -2053,7 +2053,7 @@ variants:
                             virtio_storage_path = 'F:\viostor\w7\x86'
                             virtio_network_path = 'F:\NetKVM\w7\x86'
                             #virtio_network_installer_path = 'F:\RHEV-Network32.msi'
-                        whql_submission:
+                        whql.submission:
                             dd_data_logoarch = X86
                             dd_data_logoos = Windows 7
                             dd_data_whqlos = Windows 7 Client
@@ -2083,7 +2083,7 @@ variants:
                             virtio_storage_path = 'F:\viostor\w7\amd64'
                             virtio_network_path = 'F:\NetKVM\w7\amd64'
                             #virtio_network_installer_path = 'F:\RHEV-Network64.msi'
-                        whql_submission:
+                        whql.submission:
                             dd_data_logoarch = AMD64
                             dd_data_logoos = Windows 7
                             dd_data_whqlos = Windows 7 Client x64
Signature · 1 line
1.7.3.3
#27 lore raw

PATCH 19/28 KVM test: whql.submission: don't run jobs that require manual intervention

In reply to Michael Goldish
---
 client/tests/kvm/tests_base.cfg.sample |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
client/tests/kvm/tests_base.cfg.sample +2 -0
index b2419b0..351ce99 100644
@@ -383,6 +383,8 @@ variants:
                 # Common DeviceData data
                 dd_data_filter   = FilterIfNoInf
                 dd_data_virt     = True
+                # Exclude jobs that have '(Manual)' in their names
+                job_filter = ^((?!\(Manual\)).)*$
                 variants:
                     - keyboard:
                         # test_device is a regular expression that should match a device's
Signature · 1 line
1.7.3.3
#28 lore raw

PATCH 20/28 KVM test: whql.submission: add unclassified USB tablet tests

In reply to Michael Goldish

Group all device tests under a 'device' variant and create a new 'unclassified' variant that currently contains only the tablet tests.

---
 client/tests/kvm/tests_base.cfg.sample |  134 ++++++++++++++++++--------------
 1 files changed, 77 insertions(+), 57 deletions(-)
client/tests/kvm/tests_base.cfg.sample +77 -57
index 351ce99..8d533ba 100644
@@ -386,55 +386,68 @@ variants:
                 # Exclude jobs that have '(Manual)' in their names
                 job_filter = ^((?!\(Manual\)).)*$
                 variants:
-                    - keyboard:
-                        # test_device is a regular expression that should match a device's
-                        # name as it appears in device manager.  The first device that matches
-                        # is used.
-                        test_device = keyboard
-                        # Set timeout to 10 hours
-                        test_timeout = 36000
-                        dd_data_cat0 = Input\Keyboard
-                        dd_data_cat1 = Device Fundamentals
-                        dd_data_cat2 = System Fundamentals\Dynamic Partitioning
-                        dd_data_prog = InputKbd
-                        dd_data_desc = Input > Keyboard
-                    - hdd:
-                        # Run the tests on a non-system drive
-                        # (match devices that contain 'QEMU HARDDISK' and do not contain '[C]')
-                        test_device = ^(?=.*?\bQEMU HARDDISK\b)((?!\[C\]).)*$
-                        device_data += " ex0 ex1 ex2 ex3"
-                        dd_data_cat0 = Storage\Device Class\Disk\Disk
-                        dd_data_cat1 = Storage\Device Class\Disk\Fixed
-                        dd_data_cat2 = Storage\Device Class\Disk\Bus\ATA
-                        dd_data_cat3 = Device Fundamentals
-                        dd_data_prog = StorHDD
-                        dd_data_desc = Storage > Hard Disk Drive (HDD)
-                        dd_name_ex0 = Storage_bus_type
-                        dd_data_ex0 = ATA/ATAPI
-                        dd_name_ex1 = Hybrid_HDD_Support
-                        dd_data_ex1 = 0
-                        dd_name_ex2 = Non_Rotating_Media
-                        dd_data_ex2 = 0
-                        dd_name_ex3 = Secure_Storage
-                        dd_data_ex3 = 0
-                        # Add a 2nd disk which will become D:
-                        images += " tmp"
-                        image_name_tmp = tmp
-                        image_size_tmp = 4G
-                        force_create_image_tmp = yes
-                        # Run diskpart to partition the 2nd disk
-                        whql_pre_command = "echo select disk=1 > dp.txt && "
-                        whql_pre_command += "echo create partition primary >> dp.txt && "
-                        whql_pre_command += "echo assign letter=d >> dp.txt && "
-                        whql_pre_command += "diskpart /s dp.txt & "
-                        whql_pre_command += "format d: /fs:ntfs /q /y"
+                    - unclassified:
+                        dd_data_cat0 = Device Fundamentals
+                        dd_data_cat1 = System Fundamentals\Dynamic Partitioning
+                        dd_data_prog = Unclassified
+                        dd_data_desc = Unclassified
+                        dd_data_whqlqual = Unclassified Signature
                         variants:
-                            - full:
-                                # Yes, 100 hours, this is not a mistake
-                                test_timeout = 360000
-                            - syscache_test:
-                                job_filter = syscache test
-                                test_timeout = 7200
+                            - tablet:
+                                extra_params += " -usbdevice tablet"
+                                test_device = HID-compliant mouse
+                                test_timeout = 36000
+                    - device:
+                        variants:
+                            - keyboard:
+                                # test_device is a regular expression that should match a device's
+                                # name as it appears in device manager.  The first device that matches
+                                # is used.
+                                test_device = keyboard
+                                # Set timeout to 10 hours
+                                test_timeout = 36000
+                                dd_data_cat0 = Input\Keyboard
+                                dd_data_cat1 = Device Fundamentals
+                                dd_data_cat2 = System Fundamentals\Dynamic Partitioning
+                                dd_data_prog = InputKbd
+                                dd_data_desc = Input > Keyboard
+                            - hdd:
+                                # Run the tests on a non-system drive
+                                # (match device names that contain 'QEMU HARDDISK' and do not contain '[C]')
+                                test_device = ^(?=.*?\bQEMU HARDDISK\b)((?!\[C\]).)*$
+                                device_data += " ex0 ex1 ex2 ex3"
+                                dd_data_cat0 = Storage\Device Class\Disk\Disk
+                                dd_data_cat1 = Storage\Device Class\Disk\Fixed
+                                dd_data_cat2 = Storage\Device Class\Disk\Bus\ATA
+                                dd_data_cat3 = Device Fundamentals
+                                dd_data_prog = StorHDD
+                                dd_data_desc = Storage > Hard Disk Drive (HDD)
+                                dd_name_ex0 = Storage_bus_type
+                                dd_data_ex0 = ATA/ATAPI
+                                dd_name_ex1 = Hybrid_HDD_Support
+                                dd_data_ex1 = 0
+                                dd_name_ex2 = Non_Rotating_Media
+                                dd_data_ex2 = 0
+                                dd_name_ex3 = Secure_Storage
+                                dd_data_ex3 = 0
+                                # Add a 2nd disk which will become D:
+                                images += " tmp"
+                                image_name_tmp = tmp
+                                image_size_tmp = 4G
+                                force_create_image_tmp = yes
+                                # Run diskpart to partition the 2nd disk
+                                whql_pre_command = "echo select disk=1 > dp.txt && "
+                                whql_pre_command += "echo create partition primary >> dp.txt && "
+                                whql_pre_command += "echo assign letter=d >> dp.txt && "
+                                whql_pre_command += "diskpart /s dp.txt & "
+                                whql_pre_command += "format d: /fs:ntfs /q /y"
+                                variants:
+                                    - full:
+                                        # Yes, 100 hours, this is not a mistake
+                                        test_timeout = 360000
+                                    - syscache_test:
+                                        job_filter = syscache test
+                                        test_timeout = 7200
 
     - guest_s4:     install setup unattended_install.cdrom
         type = guest_s4
@@ -1722,7 +1735,8 @@ variants:
                             dd_data_logoarch = X86
                             dd_data_logoos = Windows XP
                             dd_data_whqlos = Windows XP
-                            dd_data_whqlqual = Basic
+                            device:
+                                dd_data_whqlqual = Basic
 
                     - 64:
                         image_name += -64
@@ -1752,7 +1766,8 @@ variants:
                             dd_data_logoarch = AMD64
                             dd_data_logoos = Windows XP 64-Bit Edition Version 2003
                             dd_data_whqlos = Windows XP x64
-                            dd_data_whqlqual = Basic
+                            device:
+                                dd_data_whqlqual = Basic
 
             - Win2003:
                 image_name = win2003
@@ -1786,7 +1801,8 @@ variants:
                             dd_data_logoarch = X86
                             dd_data_logoos = Windows Server 2003
                             dd_data_whqlos = Windows Server 2003
-                            dd_data_whqlqual = Basic
+                            device:
+                                dd_data_whqlqual = Basic
 
                     - 64:
                         image_name += -64
@@ -1810,13 +1826,13 @@ variants:
                             virtio_oemsetup_id = WNET64
                             virtio_network_path = 'F:\NetKVM\2k3\amd64'
                             #virtio_network_installer_path = 'F:\RHEV-Network64.msi'
-
                         whql.submission:
                             desc_path_desc1 = $\WDK\Logo Type\Device Logo\Windows Server 2003
                             dd_data_logoarch = AMD64
                             dd_data_logoos = Windows Server 2003
                             dd_data_whqlos = Windows Server 2003 x64
-                            dd_data_whqlqual = Basic
+                            device:
+                                dd_data_whqlqual = Basic
 
             - WinVista:
                 image_name = winvista
@@ -1832,7 +1848,8 @@ variants:
                             dd_data_logoarch = X86
                             dd_data_logoos = Windows Vista
                             dd_data_whqlos = Windows Vista Client
-                            dd_data_whqlqual = Premium
+                            device:
+                                dd_data_whqlqual = Premium
                         variants:
                             - sp1:
                                 image_name += -sp1-32
@@ -1878,7 +1895,8 @@ variants:
                             dd_data_logoarch = AMD64
                             dd_data_logoos = Windows Vista
                             dd_data_whqlos = Windows Vista Client x64
-                            dd_data_whqlqual = Premium
+                            device:
+                                dd_data_whqlqual = Premium
                         variants:
                             - sp1:
                                 image_name += -sp1-64
@@ -2059,7 +2077,8 @@ variants:
                             dd_data_logoarch = X86
                             dd_data_logoos = Windows 7
                             dd_data_whqlos = Windows 7 Client
-                            dd_data_whqlqual = Logo
+                            device:
+                                dd_data_whqlqual = Logo
 
                     - 64:
                         image_name += -64
@@ -2089,7 +2108,8 @@ variants:
                             dd_data_logoarch = AMD64
                             dd_data_logoos = Windows 7
                             dd_data_whqlos = Windows 7 Client x64
-                            dd_data_whqlqual = Logo
+                            device:
+                                dd_data_whqlqual = Logo
 
 
     # Unix/BSD section
Signature · 1 line
1.7.3.3
#29 lore raw

PATCH 21/28 KVM test: refactor whql_submission_15.cs and whql_submission.py

In reply to Michael Goldish

- deps/whql_submission_15.cs:
* Handle multiple machines instead of one.
* Split the code into smaller functions.
* Get job parameters from the user: each parameter is a regex that should match a device name in a machine, and is set using GetParameterByName(). Note that job parameters differ from DeviceData objects and descriptors.
* Get machine dimensions from the user and set them for each machine.
* Set the WDKSubmissionId dimension for all machines (it seems to be required by some or all submissions).
* Instead of AddDeviceJob() use submission.ProcessJobs() and set the .Device attribute of the ScheduleItem objects returned. This is required for NDISTest to work.
* Don't set status to 'Unsafe' before resetting machines (unnecessary).
* If the machine pool already exists, delete it and create a new one.

- tests/whql_submission.py:
* Use all vms instead of just main_vm.
* Pass job parameters for each machine to the automation program.
* Pass machine dimensions for each machine.
* Write result summary to a file named 'summary' in addition to the regular logs.
* Sort results in the result summary by failures and total test count in descending order.
* Before starting the test, delete the machines from the data store, reboot them and wait for them to reappear in the data store.
* Don't restart any services on the client machines (not necessary).

- Set 'restart_vm' to 'yes' in tests_base.cfg.sample to force a restart of the VMs before each test.

---
 client/tests/kvm/deps/whql_submission_15.cs  |  662 +++++++++++++++-----------
 client/tests/kvm/deps/whql_submission_15.exe |  Bin 10240 -> 12288 bytes
 client/tests/kvm/tests/whql_submission.py    |  182 +++++---
 client/tests/kvm/tests_base.cfg.sample       |    5 +-
 4 files changed, 497 insertions(+), 352 deletions(-)
client/tests/kvm/deps/whql_submission_15.cs +373 -289
index 8fa6856..0928548 100644
@@ -1,289 +1,373 @@
-// DTM submission automation program
-// Author: Michael Goldish <[email protected]>
-// Based on sample code by Microsoft.
-
-// Note: this program has only been tested with DTM version 1.5.
-// It might fail to work with other versions, specifically because it uses
-// a few undocumented methods/attributes.
-
-using System;
-using System.Collections.Generic;
-using System.Text.RegularExpressions;
-using Microsoft.DistributedAutomation.DeviceSelection;
-using Microsoft.DistributedAutomation.SqlDataStore;
-
-namespace automate0
-{
-    class AutoJob
-    {
-        static int Main(string[] args)
-        {
-            if (args.Length != 5)
-            {
-                Console.WriteLine("Error: incorrect number of command line arguments");
-                Console.WriteLine("Usage: {0} serverName clientName machinePoolName submissionName timeout",
-                    System.Environment.GetCommandLineArgs()[0]);
-                return 1;
-            }
-            string serverName = args[0];
-            string clientName = args[1];
-            string machinePoolName = args[2];
-            string submissionName = args[3];
-            double timeout = Convert.ToDouble(args[4]);
-
-            try
-            {
-                // Initialize DeviceScript and connect to data store
-                Console.WriteLine("Initializing DeviceScript object");
-                DeviceScript script = new DeviceScript();
-                Console.WriteLine("Connecting to data store");
-
-                script.ConnectToNamedDataStore(serverName);
-
-                // Find client machine
-                IResourcePool rootPool = script.GetResourcePoolByName("$");
-                Console.WriteLine("Looking for client machine '{0}'", clientName);
-                IResource machine = null;
-                while (true)
-                {
-                    try
-                    {
-                        machine = rootPool.GetResourceByName(clientName);
-                    }
-                    catch (Exception e)
-                    {
-                        Console.WriteLine("Warning: " + e.Message);
-                    }
-                    // Make sure the machine is valid
-                    if (machine != null &&
-                        machine.OperatingSystem != null &&
-                        machine.OperatingSystem.Length > 0 &&
-                        machine.ProcessorArchitecture != null &&
-                        machine.ProcessorArchitecture.Length > 0 &&
-                        machine.GetDevices().Length > 0)
-                        break;
-                    System.Threading.Thread.Sleep(1000);
-                }
-                Console.WriteLine("Client machine '{0}' found ({1}, {2})",
-                    clientName, machine.OperatingSystem, machine.ProcessorArchitecture);
-
-                // Create machine pool and add client machine to it
-                // (this must be done because jobs cannot be scheduled for machines in the
-                // default pool)
-                try
-                {
-                    script.CreateResourcePool(machinePoolName, rootPool.ResourcePoolId);
-                }
-                catch (Exception e)
-                {
-                    Console.WriteLine("Warning: " + e.Message);
-                }
-                IResourcePool newPool = script.GetResourcePoolByName(machinePoolName);
-                Console.WriteLine("Moving the client machine to pool '{0}'", machinePoolName);
-                machine.ChangeResourcePool(newPool);
-
-                // Reset client machine
-                if (machine.Status != "Ready")
-                {
-                    Console.WriteLine("Changing the client machine's status to 'Reset'");
-                    while (true)
-                    {
-                        try
-                        {
-                            machine = rootPool.GetResourceByName(clientName);
-                            machine.ChangeResourceStatus("Unsafe");
-                            System.Threading.Thread.Sleep(5000);
-                            machine.ChangeResourceStatus("Reset");
-                            break;
-                        }
-                        catch (Exception e)
-                        {
-                            Console.WriteLine("Warning: " + e.Message);
-                        }
-                        System.Threading.Thread.Sleep(5000);
-                    }
-                    Console.WriteLine("Waiting for client machine to be ready");
-                    while (machine.Status != "Ready")
-                    {
-                        try
-                        {
-                            machine = rootPool.GetResourceByName(clientName);
-                        }
-                        catch (Exception e)
-                        {
-                            Console.WriteLine("Warning: " + e.Message);
-                        }
-                        System.Threading.Thread.Sleep(1000);
-                    }
-                }
-                Console.WriteLine("Client machine is ready");
-
-                // Get requested device regex and look for a matching device
-                Console.WriteLine("Device to test: ");
-                Regex deviceRegex = new Regex(Console.ReadLine(), RegexOptions.IgnoreCase);
-                Console.WriteLine("Looking for device '{0}'", deviceRegex);
-                IDevice device;
-                DateTime endTime = DateTime.Now.AddSeconds(120);
-                while (DateTime.Now < endTime)
-                {
-                    machine = rootPool.GetResourceByName(clientName);
-                    Console.WriteLine("(Client machine has {0} devices)", machine.GetDevices().Length);
-                    foreach (IDevice d in machine.GetDevices())
-                    {
-                        if (deviceRegex.IsMatch(d.FriendlyName))
-                        {
-                            device = d;
-                            goto deviceFound;
-                        }
-                    }
-                    System.Threading.Thread.Sleep(5000);
-                }
-                Console.WriteLine("Error: device '{0}' not found", deviceRegex);
-                return 1;
-
-            deviceFound:
-                Console.WriteLine("Found device '{0}'", device.FriendlyName);
-
-                // Get requested jobs regex
-                Console.WriteLine("Jobs to run: ");
-                Regex jobRegex = new Regex(Console.ReadLine(), RegexOptions.IgnoreCase);
-
-                // Create submission
-                Object[] existingSubmissions = script.GetSubmissionByName(submissionName);
-                if (existingSubmissions.Length > 0)
-                {
-                    Console.WriteLine("Submission '{0}' already exists -- removing it",
-                        submissionName);
-                    script.DeleteSubmission(((ISubmission)existingSubmissions[0]).Id);
-                }
-                Console.WriteLine("Creating submission '{0}'", submissionName);
-                ISubmission submission = script.CreateHardwareSubmission(submissionName,
-                    newPool.ResourcePoolId, device.InstanceId);
-
-                // Get DeviceData objects from the user
-                List<Object> deviceDataList = new List<Object>();
-                while (true)
-                {
-                    ISubmissionDeviceData dd = script.CreateNewSubmissionDeviceData();
-                    Console.WriteLine("DeviceData name: ");
-                    dd.Name = Console.ReadLine();
-                    if (dd.Name.Length == 0)
-                        break;
-                    Console.WriteLine("DeviceData data: ");
-                    dd.Data = Console.ReadLine();
-                    deviceDataList.Add(dd);
-                }
-
-                // Set the submission's DeviceData
-                submission.SetDeviceData(deviceDataList.ToArray());
-
-                // Get descriptors from the user
-                List<Object> descriptorList = new List<Object>();
-                while (true)
-                {
-                    Console.WriteLine("Descriptor path: ");
-                    string descriptorPath = Console.ReadLine();
-                    if (descriptorPath.Length == 0)
-                        break;
-                    descriptorList.Add(script.GetDescriptorByPath(descriptorPath));
-                }
-
-                // Set the submission's descriptors
-                submission.SetLogoDescriptors(descriptorList.ToArray());
-
-                // Create a schedule
-                ISchedule schedule = script.CreateNewSchedule();
-                Console.WriteLine("Scheduling jobs:");
-                int jobCount = 0;
-                foreach (IJob j in submission.GetJobs())
-                {
-                    if (jobRegex.IsMatch(j.Name))
-                     {
-                        Console.WriteLine("  " + j.Name);
-                        schedule.AddDeviceJob(device, j);
-                        jobCount++;
-                    }
-                }
-                if (jobCount == 0)
-                {
-                    Console.WriteLine("Error: no submission jobs match pattern '{0}'", jobRegex);
-                    return 1;
-                }
-                schedule.AddSubmission(submission);
-                schedule.SetResourcePool(newPool);
-                script.RunSchedule(schedule);
-
-                // Wait for jobs to complete
-                Console.WriteLine("Waiting for all jobs to complete (timeout={0})", timeout);
-                endTime = DateTime.Now.AddSeconds(timeout);
-                int numCompleted = 0, numFailed = 0;
-                while (numCompleted < submission.GetResults().Length && DateTime.Now < endTime)
-                {
-                    // Sleep for 30 seconds
-                    System.Threading.Thread.Sleep(30000);
-                    // Count completed submission jobs
-                    numCompleted = 0;
-                    foreach (IResult r in submission.GetResults())
-                        if (r.ResultStatus != "InProgress")
-                            numCompleted++;
-                    // Report results in a Python readable format and count failed schedule jobs
-                    // (submission jobs are a subset of schedule jobs)
-                    Console.WriteLine();
-                    Console.WriteLine("---- [");
-                    numFailed = 0;
-                    foreach (IResult r in schedule.GetResults())
-                    {
-                        Console.WriteLine("  {");
-                        Console.WriteLine("    'id': {0}, 'job': r'''{1}''',", r.Job.Id, r.Job.Name);
-                        Console.WriteLine("    'logs': r'''{0}''',", r.LogLocation);
-                        if (r.ResultStatus != "InProgress")
-                            Console.WriteLine("    'report': r'''{0}''',",
-                                submission.GetSubmissionResultReport(r));
-                        Console.WriteLine("    'status': '{0}',", r.ResultStatus);
-                        Console.WriteLine("    'pass': {0}, 'fail': {1}, 'notrun': {2}, 'notapplicable': {3}",
-                            r.Pass, r.Fail, r.NotRun, r.NotApplicable);
-                        Console.WriteLine("  },");
-                        numFailed += r.Fail;
-                    }
-                    Console.WriteLine("] ----");
-                }
-                Console.WriteLine();
-
-                // Cancel incomplete jobs
-                foreach (IResult r in schedule.GetResults())
-                    if (r.ResultStatus == "InProgress")
-                        r.Cancel();
-
-                // Set the machine's status to Unsafe and then Reset
-                try
-                {
-                    machine = rootPool.GetResourceByName(clientName);
-                    machine.ChangeResourceStatus("Unsafe");
-                    System.Threading.Thread.Sleep(5000);
-                    machine.ChangeResourceStatus("Reset");
-                }
-                catch (Exception e)
-                {
-                    Console.WriteLine("Warning: " + e.Message);
-                }
-
-                // Report failures
-                if (numCompleted < submission.GetResults().Length)
-                    Console.WriteLine("Some jobs did not complete on time.");
-                if (numFailed > 0)
-                    Console.WriteLine("Some jobs failed.");
-
-                if (numFailed > 0 || numCompleted < submission.GetResults().Length)
-                    return 1;
-
-                Console.WriteLine("All jobs completed.");
-                return 0;
-            }
-            catch (Exception e)
-            {
-                Console.WriteLine("Error: " + e.Message);
-                return 1;
-            }
-        }
-    }
-}
+// DTM submission automation program
+// Author: Michael Goldish <[email protected]>
+// Based on sample code by Microsoft.
+
+// Note: this program has only been tested with DTM version 1.5.
+// It might fail to work with other versions, specifically because it uses
+// a few undocumented methods/attributes.
+
+using System;
+using System.Collections.Generic;
+using System.Text.RegularExpressions;
+using Microsoft.DistributedAutomation.DeviceSelection;
+using Microsoft.DistributedAutomation.SqlDataStore;
+
+namespace automate0
+{
+    class AutoJob
+    {
+        // Wait for a machine to show up in the data store
+        static void FindMachine(IResourcePool rootPool, string machineName)
+        {
+            Console.WriteLine("Looking for machine '{0}'", machineName);
+            IResource machine = null;
+            while (true)
+            {
+                try
+                {
+                    machine = rootPool.GetResourceByName(machineName);
+                }
+                catch (Exception e)
+                {
+                    Console.WriteLine("Warning: " + e.Message);
+                }
+                // Make sure the machine is valid
+                if (machine != null &&
+                    machine.OperatingSystem != null &&
+                    machine.OperatingSystem.Length > 0 &&
+                    machine.ProcessorArchitecture != null &&
+                    machine.ProcessorArchitecture.Length > 0 &&
+                    machine.GetDevices().Length > 0)
+                    break;
+                System.Threading.Thread.Sleep(1000);
+            }
+            Console.WriteLine("Client machine '{0}' found ({1}, {2})",
+                machineName, machine.OperatingSystem, machine.ProcessorArchitecture);
+        }
+
+        // Delete a machine pool if it exists
+        static void DeleteResourcePool(IDeviceScript script, string poolName)
+        {
+            while (true)
+            {
+                try
+                {
+                    IResourcePool pool = script.GetResourcePoolByName(poolName);
+                    if (pool != null)
+                        script.DeleteResourcePool(pool);
+                    break;
+                }
+                catch (Exception e)
+                {
+                    Console.WriteLine("Warning: " + e.Message);
+                    System.Threading.Thread.Sleep(1000);
+                }
+            }
+        }
+
+        // Set the machine's status to 'Reset' and optionally wait for it to become ready
+        static void ResetMachine(IResourcePool rootPool, string machineName, bool wait)
+        {
+            Console.WriteLine("Resetting machine '{0}'", machineName);
+            IResource machine;
+            while (true)
+            {
+                try
+                {
+                    machine = rootPool.GetResourceByName(machineName);
+                    machine.ChangeResourceStatus("Reset");
+                    break;
+                }
+                catch (Exception e)
+                {
+                    Console.WriteLine("Warning: " + e.Message);
+                    System.Threading.Thread.Sleep(5000);
+                }
+            }
+            if (wait)
+            {
+                Console.WriteLine("Waiting for machine '{0}' to be ready", machineName);
+                while (machine.Status != "Ready")
+                {
+                    try
+                    {
+                        machine = rootPool.GetResourceByName(machineName);
+                    }
+                    catch (Exception e)
+                    {
+                        Console.WriteLine("Warning: " + e.Message);
+                    }
+                    System.Threading.Thread.Sleep(1000);
+                }
+                Console.WriteLine("Machine '{0}' is ready", machineName);
+            }
+        }
+
+        // Look for a device in a machine, and if not found, keep trying for 3 minutes
+        static IDevice GetDevice(IResourcePool rootPool, string machineName, string regexStr)
+        {
+            Regex deviceRegex = new Regex(regexStr, RegexOptions.IgnoreCase);
+            int numAttempts = 1;
+            DateTime endTime = DateTime.Now.AddSeconds(180);
+            while (DateTime.Now < endTime)
+            {
+                IResource machine = rootPool.GetResourceByName(machineName);
+                Console.WriteLine("Looking for device '{0}' in machine '{1}' (machine has {2} devices)",
+                    regexStr, machineName, machine.GetDevices().Length);
+                foreach (IDevice d in machine.GetDevices())
+                {
+                    if (deviceRegex.IsMatch(d.FriendlyName))
+                    {
+                        Console.WriteLine("Found device '{0}'", d.FriendlyName);
+                        return d;
+                    }
+                }
+                Console.WriteLine("Device not found");
+                if (numAttempts % 5 == 0)
+                    ResetMachine(rootPool, machineName, true);
+                else
+                    System.Threading.Thread.Sleep(5000);
+                numAttempts++;
+            }
+            Console.WriteLine("Error: device '{0}' not found", deviceRegex);
+            return null;
+        }
+
+        static int Main(string[] args)
+        {
+            if (args.Length < 5)
+            {
+                Console.WriteLine("Error: incorrect number of command line arguments");
+                Console.WriteLine("Usage: {0} serverName machinePoolName submissionName timeout machineName0 machineName1 ...",
+                    System.Environment.GetCommandLineArgs()[0]);
+                return 1;
+            }
+            string serverName = args[0];
+            string machinePoolName = args[1];
+            string submissionName = args[2];
+            double timeout = Convert.ToDouble(args[3]);
+
+            List<string> machines = new List<string>();
+            for (int i = 4; i < args.Length; i++)
+                machines.Add(args[i]);
+
+            try
+            {
+                // Initialize DeviceScript and connect to data store
+                Console.WriteLine("Initializing DeviceScript object");
+                DeviceScript script = new DeviceScript();
+                Console.WriteLine("Connecting to data store");
+                script.ConnectToNamedDataStore(serverName);
+
+                // Wait for client machines to become available
+                IResourcePool rootPool = script.GetResourcePoolByName("$");
+                foreach (string machineName in machines)
+                    FindMachine(rootPool, machineName);
+
+                // Delete the machine pool if it already exists
+                DeleteResourcePool(script, machinePoolName);
+
+                // Create the machine pool and add the client machines to it
+                // (this must be done because jobs cannot be scheduled for machines in the
+                // default pool)
+                try
+                {
+                    script.CreateResourcePool(machinePoolName, rootPool.ResourcePoolId);
+                }
+                catch (Exception e)
+                {
+                    Console.WriteLine("Warning: " + e.Message);
+                }
+                IResourcePool newPool = script.GetResourcePoolByName(machinePoolName);
+                foreach (string machineName in machines)
+                {
+                    Console.WriteLine("Moving machine '{0}' to pool '{1}'", machineName, machinePoolName);
+                    rootPool.GetResourceByName(machineName).ChangeResourcePool(newPool);
+                }
+
+                // Reset client machine
+                foreach (string machineName in machines)
+                    ResetMachine(rootPool, machineName, true);
+
+                // Get requested device regex and look for a matching device in the first machine
+                Console.WriteLine("Device to test:");
+                IDevice device = GetDevice(rootPool, machines[0], Console.ReadLine());
+                if (device == null)
+                    return 1;
+
+                // Get requested jobs regex
+                Console.WriteLine("Jobs to run:");
+                Regex jobRegex = new Regex(Console.ReadLine(), RegexOptions.IgnoreCase);
+
+                // Create a submission
+                Object[] existingSubmissions = script.GetSubmissionByName(submissionName);
+                if (existingSubmissions.Length > 0)
+                {
+                    Console.WriteLine("Submission '{0}' already exists -- removing it",
+                        submissionName);
+                    script.DeleteSubmission(((ISubmission)existingSubmissions[0]).Id);
+                }
+                string hardwareId = device.InstanceId.Remove(device.InstanceId.LastIndexOf("\\"));
+                Console.WriteLine("Creating submission '{0}' (hardware ID: {1})", submissionName, hardwareId);
+                ISubmission submission = script.CreateHardwareSubmission(submissionName, newPool.ResourcePoolId, hardwareId);
+
+                // Set submission DeviceData
+                List<Object> deviceDataList = new List<Object>();
+                while (true)
+                {
+                    ISubmissionDeviceData dd = script.CreateNewSubmissionDeviceData();
+                    Console.WriteLine("DeviceData name:");
+                    dd.Name = Console.ReadLine();
+                    if (dd.Name.Length == 0)
+                        break;
+                    Console.WriteLine("DeviceData data:");
+                    dd.Data = Console.ReadLine();
+                    deviceDataList.Add(dd);
+                }
+                submission.SetDeviceData(deviceDataList.ToArray());
+
+                // Set submission descriptors
+                List<Object> descriptorList = new List<Object>();
+                while (true)
+                {
+                    Console.WriteLine("Descriptor path:");
+                    string descriptorPath = Console.ReadLine();
+                    if (descriptorPath.Length == 0)
+                        break;
+                    descriptorList.Add(script.GetDescriptorByPath(descriptorPath));
+                }
+                submission.SetLogoDescriptors(descriptorList.ToArray());
+
+                // Set machine dimensions
+                foreach (string machineName in machines)
+                {
+                    IResource machine = rootPool.GetResourceByName(machineName);
+                    while (true)
+                    {
+                        Console.WriteLine("Dimension name ({0}):", machineName);
+                        string dimName = Console.ReadLine();
+                        if (dimName.Length == 0)
+                            break;
+                        Console.WriteLine("Dimension value ({0}):", machineName);
+                        machine.SetDimension(dimName, Console.ReadLine());
+                    }
+                    // Set the WDKSubmissionId dimension for all machines
+                    machine.SetDimension("WDKSubmissionId", submission.Id.ToString() + "_" + submission.Name);
+                }
+
+                // Get job parameters
+                List<string> paramNames = new List<string>();
+                List<string> paramValues = new List<string>();
+                foreach (string machineName in machines)
+                {
+                    while (true)
+                    {
+                        Console.WriteLine("Parameter name ({0}):", machineName);
+                        string paramName = Console.ReadLine();
+                        if (paramName.Length == 0)
+                            break;
+                        Console.WriteLine("Device regex ({0}):", machineName);
+                        IDevice d = GetDevice(rootPool, machineName, Console.ReadLine());
+                        if (d == null)
+                            return 1;
+                        string deviceName = d.GetAttribute("name")[0].ToString();
+                        Console.WriteLine("Setting parameter value to '{0}'", deviceName);
+                        paramNames.Add(paramName);
+                        paramValues.Add(deviceName);
+                    }
+                }
+
+                // Find jobs that match the requested pattern
+                Console.WriteLine("Scheduling jobs:");
+                List<IJob> jobs = new List<IJob>();
+                foreach (IJob j in submission.GetJobs())
+                {
+                    if (jobRegex.IsMatch(j.Name))
+                    {
+                        Console.WriteLine("    " + j.Name);
+                        // Set job parameters
+                        for (int i = 0; i < paramNames.Count; i++)
+                        {
+                            IParameter p = j.GetParameterByName(paramNames[i]);
+                            if (p != null)
+                                p.ScheduleValue = paramValues[i];
+                        }
+                        jobs.Add(j);
+                    }
+                }
+                if (jobs.Count == 0)
+                {
+                    Console.WriteLine("Error: no submission jobs match pattern '{0}'", jobRegex);
+                    return 1;
+                }
+
+                // Create a schedule, add jobs to it and run it
+                ISchedule schedule = script.CreateNewSchedule();
+                foreach (IScheduleItem item in submission.ProcessJobs(jobs.ToArray()))
+                {
+                    item.Device = device;
+                    schedule.AddScheduleItem(item);
+                }
+                schedule.AddSubmission(submission);
+                schedule.SetResourcePool(newPool);
+                script.RunSchedule(schedule);
+
+                // Wait for jobs to complete
+                Console.WriteLine("Waiting for all jobs to complete (timeout={0}s)", timeout);
+                DateTime endTime = DateTime.Now.AddSeconds(timeout);
+                int numCompleted, numFailed;
+                do
+                {
+                    System.Threading.Thread.Sleep(30000);
+                    // Report results in a Python readable format and count completed and failed schedule jobs
+                    numCompleted = numFailed = 0;
+                    Console.WriteLine();
+                    Console.WriteLine("---- [");
+                    foreach (IResult r in schedule.GetResults())
+                    {
+                        if (r.ResultStatus != "InProgress") numCompleted++;
+                        if (r.ResultStatus == "Investigate") numFailed++;
+                        Console.WriteLine("  {");
+                        Console.WriteLine("    'id': {0}, 'job': r'''{1}''',", r.Job.Id, r.Job.Name);
+                        Console.WriteLine("    'logs': r'''{0}''',", r.LogLocation);
+                        if (r.ResultStatus != "InProgress")
+                            Console.WriteLine("    'report': r'''{0}''',",
+                                submission.GetSubmissionResultReport(r));
+                        Console.WriteLine("    'status': '{0}',", r.ResultStatus);
+                        Console.WriteLine("    'pass': {0}, 'fail': {1}, 'notrun': {2}, 'notapplicable': {3}",
+                            r.Pass, r.Fail, r.NotRun, r.NotApplicable);
+                        Console.WriteLine("  },");
+                    }
+                    Console.WriteLine("] ----");
+                } while (numCompleted < schedule.GetResults().Length && DateTime.Now < endTime);
+
+                Console.WriteLine();
+
+                // Cancel incomplete jobs
+                foreach (IResult r in schedule.GetResults())
+                    if (r.ResultStatus == "InProgress")
+                        r.Cancel();
+
+                // Reset the machines
+                foreach (string machineName in machines)
+                    ResetMachine(rootPool, machineName, false);
+
+                // Report failures
+                if (numCompleted < schedule.GetResults().Length)
+                    Console.WriteLine("Some jobs did not complete on time.");
+                if (numFailed > 0)
+                    Console.WriteLine("Some jobs failed.");
+                if (numFailed > 0 || numCompleted < schedule.GetResults().Length)
+                    return 1;
+
+                Console.WriteLine("All jobs completed.");
+                return 0;
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine("Error: " + e.Message);
+                return 1;
+            }
+        }
+    }
+}
client/tests/kvm/deps/whql_submission_15.exe binary +0 -0
index 4f30aa801c8f200bd96b0de6c10d2b59c2bad268..605e2e3aa1f0761155f4aac5191e3ad0f0ddecc6 100644
GIT binary patch
client/tests/kvm/tests/whql_submission.py +121 -61

253 lines not on this page · raw message

client/tests/kvm/tests_base.cfg.sample +3 -2
index 8d533ba..e81d879 100644
@@ -347,11 +347,12 @@ variants:
         server_shell_port = 10022
         server_file_transfer_port = 10023
         server_studio_path = %programfiles%\Microsoft Driver Test Manager\Studio
+        dsso_test_binary = deps/whql_submission_15.exe
+        dsso_delete_machine_binary = deps/whql_delete_machine_15.exe
         wtt_services = wttsvc
         variants:
             - client_install:
                 type = whql_client_install
-                dsso_delete_machine_binary = deps/whql_delete_machine_15.exe
                 # The username and password are required for accessing the DTM client
                 # installer binary shared by the server
                 server_username = administrator
@@ -363,7 +364,7 @@ variants:
             - submission:    client_install
                 type = whql_submission
                 extra_params += " -snapshot"
-                dsso_test_binary = deps/whql_submission_15.exe
+                restart_vm = yes
                 test_timeout = 3600
                 device_data = cat0 cat1 cat2 cat3 logoarch logoos whqlos whqlqual prog desc filter virt
                 descriptors = desc1 desc2 desc3
Signature · 1 line
1.7.3.3
#30 lore raw

PATCH 22/28 KVM test: whql: add a network submission

In reply to Michael Goldish

- Add whql.support_vm_install which installs a 2nd VM that is required for NDISTest (like unattended_install.cdrom, but runs on an image with a '-supportvm' suffix).
- Split whql.client_install into .original and .support_vm.
- Append '-supportvm' to image_name of whql.client_install.support_vm.
- Add whql.submission.device.net, which defines the network submission.
- Append '-supportvm' to image_name of the 2nd VM of whql.submission.device.net for all guests.

---
 client/tests/kvm/tests_base.cfg.sample |  108 ++++++++++++++++++++++++++-----
 1 files changed, 90 insertions(+), 18 deletions(-)
client/tests/kvm/tests_base.cfg.sample +90 -18
index e81d879..83f5e4d 100644
@@ -351,7 +351,21 @@ variants:
         dsso_delete_machine_binary = deps/whql_delete_machine_15.exe
         wtt_services = wttsvc
         variants:
-            - client_install:
+            - support_vm_install:
+                # The support VM is identical to the tested VM in every way
+                # except for the image name which ends with '-supportvm'.
+                type = unattended_install
+                pre_command += " scripts/unattended.py;"
+                extra_params += " -boot d"
+                force_create_image = yes
+                kill_vm = yes
+                nic_mode = user
+                redirs += " unattended_install"
+                guest_port_unattended_install = 12323
+                medium = cdrom
+                kernel =
+                initrd = 
+            - client_install:    support_vm_install
                 type = whql_client_install
                 # The username and password are required for accessing the DTM client
                 # installer binary shared by the server
@@ -361,7 +375,10 @@ variants:
                 # (the final cmd will be something like \\servername\DTMInstall\...)
                 install_cmd = \DTMInstall\Client\Setup.exe /passive
                 install_timeout = 3600
-            - submission:    client_install
+                variants:
+                    - @original:
+                    - support_vm:
+            - submission:    client_install support_vm_install
                 type = whql_submission
                 extra_params += " -snapshot"
                 restart_vm = yes
@@ -412,6 +429,36 @@ variants:
                                 dd_data_cat2 = System Fundamentals\Dynamic Partitioning
                                 dd_data_prog = InputKbd
                                 dd_data_desc = Input > Keyboard
+                            - net:
+                                # Add a support machine and extra NICs
+                                vms += " supportvm"
+                                nics += " nic2 nic3"
+                                test_device = RTL8139.*NIC$
+                                test_timeout = 86400
+                                dd_data_cat0 = Network\LAN (Ethernet)
+                                dd_data_cat1 = Device Fundamentals
+                                dd_data_cat2 = System Fundamentals\Dynamic Partitioning
+                                dd_data_prog = NetLan
+                                dd_data_desc = Network > LAN (Ethernet)
+                                # Machine dimensions
+                                dimensions = testrole
+                                dim_name_testrole = NetDevice\TestRole
+                                dim_value_testrole_vm1 = NdistestLanClient
+                                dim_value_testrole_supportvm = NdistestLanServer
+                                # Device selection for the NDISTest client machine
+                                device_params_vm1 = testdev clientmsgdev clientsupportdev
+                                dp_name_testdev = NdistestLanClientTestDevice
+                                dp_regex_testdev = RTL8139.*NIC$
+                                dp_name_clientmsgdev = NdistestLanClientMessageDevice
+                                dp_regex_clientmsgdev = RTL8139.*NIC #2$
+                                dp_name_clientsupportdev = NdistestLanClientSupportDevice0
+                                dp_regex_clientsupportdev = RTL8139.*NIC #3$
+                                # Device selection for the NDISTest server machine
+                                device_params_supportvm = servermsgdev serversupportdev
+                                dp_name_servermsgdev = NdistestLanServerMessageDevice
+                                dp_regex_servermsgdev = RTL8139.*NIC$
+                                dp_name_serversupportdev = NdistestLanServerSupportDevice0
+                                dp_regex_serversupportdev = RTL8139.*NIC #2$
                             - hdd:
                                 # Run the tests on a non-system drive
                                 # (match device names that contain 'QEMU HARDDISK' and do not contain '[C]')
@@ -1606,7 +1653,7 @@ variants:
         mem_chk_cmd = wmic memphysical
         mem_chk_cur_cmd = wmic memphysical
 
-        unattended_install:
+        unattended_install.cdrom|whql.support_vm_install:
             timeout = 7200
             finish_program = deps/finish.exe
             cdroms += " winutils"
@@ -1718,7 +1765,7 @@ variants:
                             steps = WinXP-32.steps
                         setup:
                             steps = WinXP-32-rss.steps
-                        unattended_install.cdrom:
+                        unattended_install.cdrom|whql.support_vm_install:
                             cdrom_cd1 = isos/windows/WindowsXP-sp2-vlk.iso
                             md5sum_cd1 = 743450644b1d9fe97b3cf379e22dceb0
                             md5sum_1m_cd1 = b473bf75af2d1269fec8958cf0202bfd
@@ -1738,6 +1785,8 @@ variants:
                             dd_data_whqlos = Windows XP
                             device:
                                 dd_data_whqlqual = Basic
+                            device.net:
+                                image_name_supportvm = winXP-32-supportvm
 
                     - 64:
                         image_name += -64
@@ -1749,7 +1798,7 @@ variants:
                             steps = WinXP-64.steps
                         setup:
                             steps = WinXP-64-rss.steps
-                        unattended_install.cdrom:
+                        unattended_install.cdrom|whql.support_vm_install:
                             cdrom_cd1 = isos/windows/WindowsXP-64.iso
                             md5sum_cd1 = 8d3f007ec9c2060cec8a50ee7d7dc512
                             md5sum_1m_cd1 = e812363ff427effc512b7801ee70e513
@@ -1769,6 +1818,8 @@ variants:
                             dd_data_whqlos = Windows XP x64
                             device:
                                 dd_data_whqlqual = Basic
+                            device.net:
+                                image_name_supportvm = winXP-64-supportvm
 
             - Win2003:
                 image_name = win2003
@@ -1785,7 +1836,7 @@ variants:
                             steps = Win2003-32.steps
                         setup:
                             steps = Win2003-32-rss.steps
-                        unattended_install.cdrom:
+                        unattended_install.cdrom|whql.support_vm_install:
                             cdrom_cd1 = isos/windows/Windows2003_r2_VLK.iso
                             md5sum_cd1 = 03e921e9b4214773c21a39f5c3f42ef7
                             md5sum_1m_cd1 = 37c2fdec15ac4ec16aa10fdfdb338aa3
@@ -1804,6 +1855,8 @@ variants:
                             dd_data_whqlos = Windows Server 2003
                             device:
                                 dd_data_whqlqual = Basic
+                            device.net:
+                                image_name_supportvm = win2003-32-supportvm
 
                     - 64:
                         image_name += -64
@@ -1815,7 +1868,7 @@ variants:
                             steps = Win2003-64.steps
                         setup:
                             steps = Win2003-64-rss.steps
-                        unattended_install.cdrom:
+                        unattended_install.cdrom|whql.support_vm_install:
                             cdrom_cd1 = isos/windows/Windows2003-x64.iso
                             md5sum_cd1 = 5703f87c9fd77d28c05ffadd3354dbbd
                             md5sum_1m_cd1 = 439393c384116aa09e08a0ad047dcea8
@@ -1834,6 +1887,8 @@ variants:
                             dd_data_whqlos = Windows Server 2003 x64
                             device:
                                 dd_data_whqlqual = Basic
+                            device.net:
+                                image_name_supportvm = win2003-64-supportvm
 
             - WinVista:
                 image_name = winvista
@@ -1861,7 +1916,7 @@ variants:
                                     steps = Win-Vista-32.steps
                                 setup:
                                     steps = WinVista-32-rss.steps
-                                unattended_install.cdrom:
+                                unattended_install.cdrom|whql.support_vm_install:
                                     cdrom_cd1 = isos/windows/WindowsVista-32.iso
                                     md5sum_cd1 = 1008f323d5170c8e614e52ccb85c0491
                                     md5sum_1m_cd1 = c724e9695da483bc0fd59e426eaefc72
@@ -1873,10 +1928,12 @@ variants:
                                     virtio_storage_path = 'F:\viostor\w7\x86'
                                     virtio_network_path = 'F:\NetKVM\w7\x86'
                                     #virtio_network_installer_path = 'F:\RHEV-Network32.msi'
+                                whql.submission.device.net:
+                                    image_name_supportvm = winvista-sp1-32-supportvm
 
                             - sp2:
                                 image_name += -sp2-32
-                                unattended_install.cdrom:
+                                unattended_install.cdrom|whql.support_vm_install:
                                     cdrom_cd1 = isos/windows/en_windows_vista_with_sp2_x86_dvd_342266.iso
                                     md5sum_cd1 = 19ca90a425667812977bab6f4ce24175
                                     md5sum_1m_cd1 = 89c15020e0e6125be19acf7a2e5dc614
@@ -1890,6 +1947,8 @@ variants:
                                     virtio_storage_path = 'F:\viostor\w7\x86'
                                     virtio_network_path = 'F:\NetKVM\w7\x86'
                                     #virtio_network_installer_path = 'F:\RHEV-Network32.msi'
+                                whql.submission.device.net:
+                                    image_name_supportvm = winvista-sp2-32-supportvm
 
                     - 64:
                         whql.submission:
@@ -1908,7 +1967,7 @@ variants:
                                     steps = Win-Vista-64.steps
                                 setup:
                                     steps = WinVista-64-rss.steps
-                                unattended_install.cdrom:
+                                unattended_install.cdrom|whql.support_vm_install:
                                     cdrom_cd1 = isos/windows/WindowsVista-64.iso
                                     md5sum_cd1 = 11e2010d857fffc47813295e6be6d58d
                                     md5sum_1m_cd1 = 0947bcd5390546139e25f25217d6f165
@@ -1920,9 +1979,12 @@ variants:
                                     virtio_storage_path = 'F:\viostor\w7\amd64'
                                     virtio_network_path = 'F:\NetKVM\w7\amd64'
                                     #virtio_network_installer_path = 'F:\RHEV-Network64.msi'
+                                whql.submission.device.net:
+                                    image_name_supportvm = winvista-sp1-64-supportvm
+
                             - sp2:
                                 image_name += -sp2-64
-                                unattended_install.cdrom:
+                                unattended_install.cdrom|whql.support_vm_install:
                                     cdrom_cd1 = isos/windows/en_windows_vista_sp2_x64_dvd_342267.iso
                                     md5sum_cd1 = a1c024d7abaf34bac3368e88efbc2574
                                     md5sum_1m_cd1 = 3d84911a80f3df71d1026f7adedc2181
@@ -1936,6 +1998,8 @@ variants:
                                     virtio_storage_path = 'F:\viostor\w7\amd64'
                                     virtio_network_path = 'F:\NetKVM\w7\amd64'
                                     #virtio_network_installer_path = 'F:\RHEV-Network64.msi'
+                                whql.submission.device.net:
+                                    image_name_supportvm = winvista-sp2-64-supportvm
 
             - Win2008:
                 no whql
@@ -1956,7 +2020,7 @@ variants:
                                     steps = Win2008-32.steps
                                 setup:
                                     steps = Win2008-32-rss.steps
-                                unattended_install.cdrom:
+                                unattended_install.cdrom|whql.support_vm_install:
                                     cdrom_cd1 = isos/windows/Windows2008-x86.iso
                                     md5sum=0bfca49f0164de0a8eba236ced47007d
                                     md5sum_1m=07d7f5006393f74dc76e6e2e943e2440
@@ -1971,7 +2035,7 @@ variants:
 
                             - sp2:
                                 image_name += -sp2-32
-                                unattended_install.cdrom:
+                                unattended_install.cdrom|whql.support_vm_install:
                                     cdrom_cd1 = isos/windows/en_windows_server_2008_datacenter_enterprise_standard_sp2_x86_dvd_342333.iso
                                     md5sum_cd1 = b9201aeb6eef04a3c573d036a8780bdf
                                     md5sum_1m_cd1 = b7a9d42e55ea1e85105a3a6ad4da8e04
@@ -2000,7 +2064,7 @@ variants:
                                     passwd = 1q2w3eP
                                 setup:
                                     steps = Win2008-64-rss.steps
-                                unattended_install.cdrom:
+                                unattended_install.cdrom|whql.support_vm_install:
                                     cdrom_cd1 = isos/windows/Windows2008-x64.iso
                                     md5sum=27c58cdb3d620f28c36333a5552f271c
                                     md5sum_1m=efdcc11d485a1ef9afa739cb8e0ca766
@@ -2015,7 +2079,7 @@ variants:
 
                             - sp2:
                                 image_name += -sp2-64
-                                unattended_install.cdrom:
+                                unattended_install.cdrom|whql.support_vm_install:
                                     cdrom_cd1 = isos/windows/en_windows_server_2008_datacenter_enterprise_standard_sp2_x64_dvd_342336.iso
                                     md5sum_cd1 = e94943ef484035b3288d8db69599a6b5
                                     md5sum_1m_cd1 = ee55506823d0efffb5532ddd88a8e47b
@@ -2032,7 +2096,7 @@ variants:
 
                             - r2:
                                 image_name += -r2-64
-                                unattended_install.cdrom:
+                                unattended_install.cdrom|whql.support_vm_install:
                                     cdrom_cd1 = isos/windows/en_windows_server_2008_r2_standard_enterprise_datacenter_and_web_x64_dvd_x15-59754.iso
                                     md5sum_cd1 = 0207ef392c60efdda92071b0559ca0f9
                                     md5sum_1m_cd1 = a5a22ce25008bd7109f6d830d627e3ed
@@ -2060,7 +2124,7 @@ variants:
                 variants:
                     - 32:
                         image_name += -32
-                        unattended_install.cdrom:
+                        unattended_install.cdrom|whql.support_vm_install:
                             cdrom_cd1 = isos/windows/en_windows_7_ultimate_x86_dvd_x15-65921.iso
                             md5sum_cd1 = d0b8b407e8a3d4b75ee9c10147266b89
                             md5sum_1m_cd1 = 2b0c2c22b1ae95065db08686bf83af93
@@ -2080,6 +2144,8 @@ variants:
                             dd_data_whqlos = Windows 7 Client
                             device:
                                 dd_data_whqlqual = Logo
+                            device.net:
+                                image_name_supportvm = win7-32-supportvm
 
                     - 64:
                         image_name += -64
@@ -2091,7 +2157,7 @@ variants:
                             steps = Win7-64.steps
                         setup:
                             steps = Win7-64-rss.steps
-                        unattended_install.cdrom:
+                        unattended_install.cdrom|whql.support_vm_install:
                             cdrom_cd1 = isos/windows/en_windows_7_ultimate_x64_dvd_x15-65922.iso
                             md5sum_cd1 = f43d22e4fb07bf617d573acd8785c028
                             md5sum_1m_cd1 = b44d8cf99dbed2a5cb02765db8dfd48f
@@ -2111,6 +2177,8 @@ variants:
                             dd_data_whqlos = Windows 7 Client x64
                             device:
                                 dd_data_whqlqual = Logo
+                            device.net:
+                                image_name_supportvm = win7-64-supportvm
 
 
     # Unix/BSD section
@@ -2169,6 +2237,10 @@ variants:
                 md5sum_cd1 = 9fae22f2666369968a76ef59e9a81ced
 
 
+whql.support_vm_install|whql.client_install.support_vm:
+    image_name += -supportvm
+
+
 variants:
     - @up:
         no autotest.npb autotest.tsc
Signature · 1 line
1.7.3.3
#31 lore raw

PATCH 23/28 KVM test: whql.submission: use a different submission name for each submission category

In reply to Michael Goldish
---
 client/tests/kvm/tests/whql_submission.py |   10 +++++-----
 client/tests/kvm/tests_base.cfg.sample    |    4 ++++
 2 files changed, 9 insertions(+), 5 deletions(-)
client/tests/kvm/tests/whql_submission.py +5 -5
index a0ff87c..e40e369 100644
@@ -76,12 +76,12 @@ def run_whql_submission(test, params, env):
             session.close()
 
     # Run the automation program on the server
+    pool_name = "%s_pool" % client_names[0]
+    submission_name = "%s_%s" % (client_names[0],
+                                 params.get("submission_name"))
     cmd = "%s %s %s %s %s %s" % (os.path.basename(dsso_test_binary),
-                                 server_name,
-                                 "%s_pool" % client_names[0],
-                                 "%s_submission" % client_names[0],
-                                 test_timeout,
-                                 " ".join(client_names))
+                                 server_name, pool_name, submission_name,
+                                 test_timeout, " ".join(client_names))
     server_session.sendline(cmd)
 
     # Helper function: wait for a given prompt and raise an exception if an
client/tests/kvm/tests_base.cfg.sample +4 -0
index 83f5e4d..c765463 100644
@@ -412,12 +412,14 @@ variants:
                         dd_data_whqlqual = Unclassified Signature
                         variants:
                             - tablet:
+                                submission_name = tablet
                                 extra_params += " -usbdevice tablet"
                                 test_device = HID-compliant mouse
                                 test_timeout = 36000
                     - device:
                         variants:
                             - keyboard:
+                                submission_name = keyboard
                                 # test_device is a regular expression that should match a device's
                                 # name as it appears in device manager.  The first device that matches
                                 # is used.
@@ -430,6 +432,7 @@ variants:
                                 dd_data_prog = InputKbd
                                 dd_data_desc = Input > Keyboard
                             - net:
+                                submission_name = net
                                 # Add a support machine and extra NICs
                                 vms += " supportvm"
                                 nics += " nic2 nic3"
@@ -460,6 +463,7 @@ variants:
                                 dp_name_serversupportdev = NdistestLanServerSupportDevice0
                                 dp_regex_serversupportdev = RTL8139.*NIC #2$
                             - hdd:
+                                submission_name = hdd
                                 # Run the tests on a non-system drive
                                 # (match device names that contain 'QEMU HARDDISK' and do not contain '[C]')
                                 test_device = ^(?=.*?\bQEMU HARDDISK\b)((?!\[C\]).)*$
Signature · 1 line
1.7.3.3
#32 lore raw

PATCH 24/28 KVM test: whql.client_install: setup auto logon for DTMLLUAdminUser

In reply to Michael Goldish

Some tests complain about DTMLLUAdminUser (the user created by the DTM client installer) not being logged on, so make it logon automatically instead of Administrator.

---
 client/tests/kvm/tests/whql_client_install.py |   17 +++++++++++++++++
 client/tests/kvm/tests_base.cfg.sample        |    6 ++++++
 2 files changed, 23 insertions(+), 0 deletions(-)
client/tests/kvm/tests/whql_client_install.py +17 -0
index 8e63d10..c2616c6 100644
@@ -13,6 +13,9 @@ def run_whql_client_install(test, params, env):
     5) Move the client machine into the server's workgroup
     6) Reboot the client machine
     7) Install the DTM client software
+    8) Setup auto logon for the user created by the installation
+       (normally DTMLLUAdminUser)
+    9) Reboot again
 
     @param test: kvm test object
     @param params: Dictionary with the test parameters
@@ -29,6 +32,8 @@ def run_whql_client_install(test, params, env):
                                     "Microsoft Driver Test Manager\\Studio")
     server_username = params.get("server_username")
     server_password = params.get("server_password")
+    client_username = params.get("client_username")
+    client_password = params.get("client_password")
     dsso_delete_machine_binary = params.get("dsso_delete_machine_binary",
                                             "deps/whql_delete_machine_15.exe")
     dsso_delete_machine_binary = kvm_utils.get_path(test.bindir,
@@ -115,4 +120,16 @@ def run_whql_client_install(test, params, env):
     logging.info("Installing DTM client (timeout=%ds)", install_timeout)
     install_cmd = r"cmd /c \\%s\%s" % (server_name, install_cmd.lstrip("\\"))
     session.cmd(install_cmd, timeout=install_timeout)
+
+    # Setup auto logon
+    logging.info("Setting up auto logon for user '%s'", client_username)
+    cmd = ('reg add '
+           '"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\winlogon" '
+           '/v "%s" /d "%s" /t REG_SZ /f')
+    session.cmd(cmd % ("AutoAdminLogon", "1"))
+    session.cmd(cmd % ("DefaultUserName", client_username))
+    session.cmd(cmd % ("DefaultPassword", client_password))
+
+    # Reboot one more time
+    session = kvm_test_utils.reboot(vm, session)
     session.close()
client/tests/kvm/tests_base.cfg.sample +6 -0
index c765463..302c3d8 100644
@@ -375,6 +375,12 @@ variants:
                 # (the final cmd will be something like \\servername\DTMInstall\...)
                 install_cmd = \DTMInstall\Client\Setup.exe /passive
                 install_timeout = 3600
+                # The test will setup auto logon on the client machine using the
+                # following username and password:
+                client_username = DTMLLUAdminUser
+                client_password = Testpassword,1
+                # (These are created by the DTM client installer and should probably not
+                # be changed.)
                 variants:
                     - @original:
                     - support_vm:
Signature · 1 line
1.7.3.3
#33 lore raw

PATCH 25/28 KVM test: whql.submission: don't use any cdroms

In reply to Michael Goldish

whql.submission doesn't require any cdroms so get rid of them.

---
 client/tests/kvm/tests_base.cfg.sample |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
client/tests/kvm/tests_base.cfg.sample +1 -0
index 302c3d8..4be0ad2 100644
@@ -388,6 +388,7 @@ variants:
                 type = whql_submission
                 extra_params += " -snapshot"
                 restart_vm = yes
+                cdroms =
                 test_timeout = 3600
                 device_data = cat0 cat1 cat2 cat3 logoarch logoos whqlos whqlqual prog desc filter virt
                 descriptors = desc1 desc2 desc3
Signature · 1 line
1.7.3.3
#34 lore raw

PATCH 26/28 KVM test: whql.submission: support VirtIO network tests

In reply to Michael Goldish
---
 client/tests/kvm/tests_base.cfg.sample |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
client/tests/kvm/tests_base.cfg.sample +9 -0
index 4be0ad2..97b626f 100644
@@ -853,6 +853,15 @@ variants:
             mtu = 65520
         ethtool:
             supported_features = "tx sg tso gso"
+        whql.submission.device.net:
+            test_device = VirtIO Ethernet Adapter$
+            # Device selection for the NDISTest client machine
+            dp_regex_testdev = VirtIO Ethernet Adapter$
+            dp_regex_clientmsgdev = VirtIO Ethernet Adapter #2$
+            dp_regex_clientsupportdev = VirtIO Ethernet Adapter #3$
+            # Device selection for the NDISTest server machine
+            dp_regex_servermsgdev = VirtIO Ethernet Adapter$
+            dp_regex_serversupportdev = VirtIO Ethernet Adapter #2$
 
 # Guests
 variants:
Signature · 1 line
1.7.3.3
#35 lore raw

PATCH 27/28 KVM test: whql.submission: reorder DeviceData

In reply to Michael Goldish

The DeviceData order should now match the order in the XMLs produced by the DTM studio, which should make it easier to look at diffs (for debugging) between the XMLs produced by the automation program and the those produced by the DTM studio

---
 client/tests/kvm/tests_base.cfg.sample |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
client/tests/kvm/tests_base.cfg.sample +1 -1
index 97b626f..f5ff5e9 100644
@@ -390,7 +390,7 @@ variants:
                 restart_vm = yes
                 cdroms =
                 test_timeout = 3600
-                device_data = cat0 cat1 cat2 cat3 logoarch logoos whqlos whqlqual prog desc filter virt
+                device_data = cat0 cat1 cat2 cat3 prog desc virt filter logoarch logoos whqlos whqlqual
                 descriptors = desc1 desc2 desc3
                 # DeviceData names
                 dd_name_cat0     = Category
Signature · 1 line
1.7.3.3
#36 lore raw

PATCH 28/28 KVM test: whql_submission.py: log in using all NICs before running tests

In reply to Michael Goldish

This will make sure all NICs are up before beginning testing. Useful for network tests. For other tests it should be harmless as they only use a single NIC.

---
 client/tests/kvm/tests/whql_submission.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
client/tests/kvm/tests/whql_submission.py +14 -0
index e40e369..2d01e30 100644
@@ -25,6 +25,13 @@ def run_whql_submission(test, params, env):
         vms.append(kvm_test_utils.get_living_vm(env, vm_name))
         sessions.append(kvm_test_utils.wait_for_login(vms[-1], 0, 240))
 
+    # Make sure all NICs of all client VMs are up
+    for vm in vms:
+        nics = kvm_utils.get_sub_dict_names(vm.params, "nics")
+        for nic_index in range(len(nics)):
+            s = kvm_test_utils.wait_for_login(vm, nic_index, 600)
+            s.close()
+
     # Collect parameters
     server_address = params.get("server_address")
     server_shell_port = int(params.get("server_shell_port"))
@@ -68,6 +75,13 @@ def run_whql_submission(test, params, env):
     sessions = kvm_utils.parallel((kvm_test_utils.reboot, (vm, session))
                                   for vm, session in zip(vms, sessions))
 
+    # Check the NICs again
+    for vm in vms:
+        nics = kvm_utils.get_sub_dict_names(vm.params, "nics")
+        for nic_index in range(len(nics)):
+            s = kvm_test_utils.wait_for_login(vm, nic_index, 600)
+            s.close()
+
     # Run whql_pre_command and close the sessions
     if params.get("whql_pre_command"):
         for session in sessions:
Signature · 1 line
1.7.3.3