Skip to contentSkip to conversation

KVM test: configuration interface changes

PATCH In review Michael Goldish 2 participants 8 messages Aug 9, 2009 – Aug 17, 2009 KVM

lore
Share & tools
lore
#0 lore raw

cover KVM test: configuration interface changes

This patch set modifies the names and functionality of several config parameters and adds new ones.
It also adds support for Netcat as a remote shell client.

It breaks compatibility with existing test configurations.

#1 lore raw

PATCH 1/6 KVM test: rename SSH related parameters and functions and add new ones

(This patch breaks compatibility with existing config files.)

We now support both SSH and Telnet for communicating with guests, and will soon use Netcat as well. It makes no sense to keep 'ssh' in the names of many remote shell related functions and parameters. Therefore the following renaming was performed:

Functions:
ssh_login -> remote_login
scp_to_remote -> copy_files_to
scp_from_remote -> copy_files_from

Config parameters:
ssh_port -> shell_port
guest_port_ssh -> guest_port_remote_shell
ssh_prompt -> shell_prompt
ssh_status_test_command -> status_test_command
cmd_shutdown -> shutdown_command
cmd_reboot -> reboot_command

Also, new parameters were added:
shell_client (ssh, telnet or nc)
file_transfer_client (currently only scp)
file_transfer_port

The parameter use_telnet was removed, as well as the function VM.ssh().

---
 client/tests/kvm/kvm_tests.cfg.sample |   47 ++++++++-----
 client/tests/kvm/kvm_tests.py         |   52 +++++++-------
 client/tests/kvm/kvm_utils.py         |   26 ++++---
 client/tests/kvm/kvm_vm.py            |  121 ++++++++++++++++-----------------
 4 files changed, 127 insertions(+), 119 deletions(-)
client/tests/kvm/kvm_tests.cfg.sample +28 -19
index 3a4bf64..8238f3e 100644
@@ -17,12 +17,12 @@ kill_vm_gracefully = yes
 # Some default VM params
 mem = 512
 image_size = 10G
-ssh_port = 22
+shell_port = 22
 display = vnc
 
 # Port redirections
-redirs = ssh
-guest_port_ssh = 22
+redirs = remote_shell
+guest_port_remote_shell = 22
 
 # NIC parameters
 nic_mode = tap
@@ -146,16 +146,20 @@ variants:
     # Linux section
     - @Linux:
         no timedrift
-        cmd_shutdown = shutdown -h now
-        cmd_reboot = shutdown -r now
-        ssh_status_test_command = echo $?
+        shutdown_command = shutdown -h now
+        reboot_command = shutdown -r now
+        status_test_command = echo $?
         username = root
         password = 123456
+        shell_client = ssh
+        shell_port = 22
+        file_transfer_client = scp
+        file_transfer_port = 22
 
         variants:
             - Fedora:
                 no setup
-                ssh_prompt = "\[root@.{0,50}][\#\$] "
+                shell_prompt = "\[root@.{0,50}][\#\$] "
 
                 variants:
                     - 8.32:
@@ -237,7 +241,7 @@ variants:
                     md5sum_1m = 768ca32503ef92c28f2d144f2a87e4d0
 
             - @Ubuntu:
-                ssh_prompt = "root@.{0,50}[\#\$] "
+                shell_prompt = "root@.{0,50}[\#\$] "
 
                 variants:
                     - Ubuntu-6.10-32:
@@ -269,7 +273,7 @@ variants:
 
             - RHEL:
                 no setup
-                ssh_prompt = "\[root@.{0,50}][\#\$] "
+                shell_prompt = "\[root@.{0,50}][\#\$] "
 
                 variants:
                     - 5.3.i386:
@@ -329,12 +333,17 @@ variants:
     # Windows section
     - @Windows:
         no autotest
-        cmd_shutdown = shutdown /s /t 0
-        cmd_reboot = shutdown /r /t 0
-        ssh_prompt = "C:\\.{0,50}>"
-        ssh_status_test_command = echo %errorlevel%
+        shutdown_command = shutdown /s /t 0
+        reboot_command = shutdown /r /t 0
+        status_test_command = echo %errorlevel%
+        shell_prompt = "C:\\.{0,50}>"
         username = Administrator
         password = 123456
+        shell_client = ssh
+        shell_port = 22
+        file_transfer_client = scp
+        file_transfer_port = 22
+
         migrate:
             migration_test_command = ver && vol
         stress_boot:
@@ -394,8 +403,8 @@ variants:
 
             - Win2003:
                 image_size = 20G
-                cmd_shutdown = shutdown /s /f /t 0
-                cmd_reboot = shutdown /r /f /t 0
+                shutdown_command = shutdown /s /f /t 0
+                reboot_command = shutdown /r /f /t 0
 
                 variants:
                     - 32:
@@ -443,10 +452,10 @@ variants:
             - Win2008:
                 image_name = win2008
                 image_size = 20G
-                cmd_shutdown = shutdown /s /f /t 0
-                cmd_reboot = shutdown /r /f /t 0
-                ssh_port = 23
-                guest_port_ssh = 23
+                shutdown_command = shutdown /s /f /t 0
+                reboot_command = shutdown /r /f /t 0
+                shell_port = 23
+                guest_port_remote_shell = 23
                 use_telnet = yes
                 username = Administrator
                 password = 1q2w3eP
client/tests/kvm/kvm_tests.py +26 -26

193 lines not on this page · raw message

client/tests/kvm/kvm_utils.py +14 -12
index 17c2b73..d1c9781 100644
@@ -492,9 +492,9 @@ def scp_to_remote(host, port, username, password, local_path, remote_path,
     """
     Copy files to a remote host (guest).
 
-    @param host: Hostname of the guest
-    @param username: User that will be used to copy the files
-    @param password: Host's password
+    @param host: Hostname or IP address
+    @param username: Username (if required)
+    @param password: Password (if required)
     @param local_path: Path on the local machine where we are copying from
     @param remote_path: Path on the remote machine where we are copying to
     @param timeout: Time in seconds that we will wait before giving up to
@@ -512,9 +512,9 @@ def scp_from_remote(host, port, username, password, remote_path, local_path,
     """
     Copy files from a remote host (guest).
 
-    @param host: Hostname of the guest
-    @param username: User that will be used to copy the files
-    @param password: Host's password
+    @param host: Hostname or IP address
+    @param username: Username (if required)
+    @param password: Password (if required)
     @param local_path: Path on the local machine where we are copying from
     @param remote_path: Path on the remote machine where we are copying to
     @param timeout: Time in seconds that we will wait before giving up to copy
@@ -531,9 +531,10 @@ def ssh(host, port, username, password, prompt, timeout=10):
     """
     Log into a remote host (guest) using SSH.
 
-    @param host: Hostname of the guest
-    @param username: User that will be used to log into the host.
-    @param password: Host's password
+    @param host: Hostname or IP address
+    @param username: Username (if required)
+    @param password: Password (if required)
+    @param prompt: Shell prompt (regular expression)
     @timeout: Time in seconds that we will wait before giving up on logging
             into the host.
 
@@ -548,9 +549,10 @@ def telnet(host, port, username, password, prompt, timeout=10):
     """
     Log into a remote host (guest) using Telnet.
 
-    @param host: Hostname of the guest
-    @param username: User that will be used to log into the host.
-    @param password: Host's password
+    @param host: Hostname or IP address
+    @param username: Username (if required)
+    @param password: Password (if required)
+    @param prompt: Shell prompt (regular expression)
     @timeout: Time in seconds that we will wait before giving up on logging
             into the host.
 
client/tests/kvm/kvm_vm.py +59 -62

205 lines not on this page · raw message

Signature · 1 line
1.5.4.1
#2 lore raw

PATCH 2/6 KVM test: support Netcat as a remote shell client

This is useful for Windows guests that will use the homemade remote shell server.

---
 client/tests/kvm/kvm_utils.py |   17 +++++++++++++++++
 client/tests/kvm/kvm_vm.py    |    3 +++
 2 files changed, 20 insertions(+), 0 deletions(-)
client/tests/kvm/kvm_utils.py +17 -0
index d1c9781..4c4753b 100644
@@ -562,6 +562,23 @@ def telnet(host, port, username, password, prompt, timeout=10):
     return remote_login(command, password, prompt, "\r\n", timeout)
 
 
+def netcat(host, port, username, password, prompt, timeout=10):
+    """
+    Log into a remote host (guest) using Netcat.
+
+    @param host: Hostname or IP address
+    @param username: Username (if required)
+    @param password: Password (if required)
+    @param prompt: Shell prompt (regular expression)
+    @timeout: Time in seconds that we will wait before giving up on logging
+            into the host.
+
+    @return: kvm_spawn object on success and None on failure.
+    """
+    command = "nc %s %s" % (host, port)
+    return remote_login(command, password, prompt, "\n", timeout)
+
+
 # The following are utility functions related to ports.
 
 def is_sshd_running(host, port, timeout=10.0):
client/tests/kvm/kvm_vm.py +3 -0
index 4a862bd..7bc3d75 100644
@@ -727,6 +727,9 @@ class VM:
         elif client == "telnet":
             session = kvm_utils.telnet(address, port, username, password,
                                        prompt, timeout)
+        elif client == "nc":
+            session = kvm_utils.netcat(address, port, username, password,
+                                       prompt, timeout)
 
         if session:
             session.set_status_test_command(self.params.get("status_test_"
Signature · 1 line
1.5.4.1
#3 lore raw

PATCH 3/6 KVM test: add a function that translates user specified paths to real ones

If a user specified path is an absolute one, it is returned as is. If it's relative, it's appended to a certain base path.

This function is meant to allow framework and test code to treat all user specified paths equally.

---
 client/tests/kvm/kvm_utils.py |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
client/tests/kvm/kvm_utils.py +15 -0
index 4c4753b..5e9e90d 100644
@@ -677,6 +677,21 @@ def find_free_ports(start_port, end_port, count):
 
 # The following are miscellaneous utility functions.
 
+def get_path(base_path, user_path):
+    """
+    Translate a user specified path to a real path.
+    If user_path is relative, append it to base_path.
+    If user_path is absolute, return it as is.
+
+    @param base_path: The base path of relative user specified paths.
+    @param user_path: The user specified path.
+    """
+    if os.path.isabs(user_path):
+        return user_path
+    else:
+        return os.path.join(base_path, user_path)
+
+
 def generate_random_string(length):
     """
     Return a random string using alphanumeric characters.
Signature · 1 line
1.5.4.1
#4 lore raw

PATCH 4/6 KVM test: allow for regex matching of keys in the config parser

Allow for statements with the following syntax:

regex ?= value         (set)
regex ?+= value        (append)
regex ?<= value        (prepend)

These operations are performed only for keys that match regex. The whole key name must match the expression, so if regex is a regular string, only the key whose name equals this string is modified.

This is useful for modifying all parameters of a certain type regardless of the objects they apply to. For example, the following parameters specify the cdrom filenames for different objects: cdrom_vm1, cdrom_vm2, cdrom. It is now possible to modify all of them with a statement such
cdrom.* ?<= shared_
which would prepend the string 'shared_' to all cdrom filenames.

---
 client/tests/kvm/kvm_config.py |   34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 deletions(-)
client/tests/kvm/kvm_config.py +23 -11
index 7ff7a07..b7bddbd 100755
@@ -316,20 +316,32 @@ class config:
                 for filter in filters:
                     filtered_list = self.filter(filter, filtered_list)
                 # Apply the operation to the filtered list
-                for dict in filtered_list:
-                    if op_found == "=":
+                if op_found == "=":
+                    for dict in filtered_list:
                         dict[key] = value
-                    elif op_found == "+=":
+                elif op_found == "+=":
+                    for dict in filtered_list:
                         dict[key] = dict.get(key, "") + value
-                    elif op_found == "<=":
+                elif op_found == "<=":
+                    for dict in filtered_list:
                         dict[key] = value + dict.get(key, "")
-                    elif op_found.startswith("?") and dict.has_key(key):
-                        if op_found == "?=":
-                            dict[key] = value
-                        elif op_found == "?+=":
-                            dict[key] = dict.get(key, "") + value
-                        elif op_found == "?<=":
-                            dict[key] = value + dict.get(key, "")
+                elif op_found.startswith("?"):
+                    exp = re.compile("^(%s)$" % key)
+                    if op_found == "?=":
+                        for dict in filtered_list:
+                            for key in dict.keys():
+                                if exp.match(key):
+                                    dict[key] = value
+                    elif op_found == "?+=":
+                        for dict in filtered_list:
+                            for key in dict.keys():
+                                if exp.match(key):
+                                    dict[key] = dict.get(key, "") + value
+                    elif op_found == "?<=":
+                        for dict in filtered_list:
+                            for key in dict.keys():
+                                if exp.match(key):
+                                    dict[key] = value + dict.get(key, "")
 
             # Parse 'no' and 'only' statements
             elif words[0] == "no" or words[0] == "only":
Signature · 1 line
1.5.4.1
#5 lore raw

PATCH 5/6 KVM test: treat all user specified paths equally

(This patch breaks compatibility with existing config files.)

The user must now specify paths relative to test.bindir whenever a path is required. For example, image filenames specified in the config file should now begin with 'images/', cdrom filenames should begin with 'isos/' and stepfile filenames should begin with 'steps/'.

This patch modifies kvm_vm.py, kvm_preprocessing.py, kvm_guest_wizard.py, stepmaker.py and and kvm_tests.cfg.sample.

---
 client/tests/kvm/kvm_guest_wizard.py  |    2 +-
 client/tests/kvm/kvm_preprocessing.py |   21 ++-----
 client/tests/kvm/kvm_tests.cfg.sample |    5 ++
 client/tests/kvm/kvm_vm.py            |  106 ++++++++++++---------------------
 client/tests/kvm/stepmaker.py         |    2 +-
 5 files changed, 51 insertions(+), 85 deletions(-)
client/tests/kvm/kvm_guest_wizard.py +1 -1
index 73b830e..732e427 100644
@@ -185,7 +185,7 @@ def run_steps(test, params, env):
     steps_filename = params.get("steps")
     if not steps_filename:
         raise error.TestError("Steps filename not specified")
-    steps_filename = os.path.join(test.bindir, "steps", steps_filename)
+    steps_filename = kvm_utils.get_path(test.bindir, steps_filename)
     if not os.path.exists(steps_filename):
         raise error.TestError("Steps file not found: %s" % steps_filename)
 
client/tests/kvm/kvm_preprocessing.py +6 -15
index a5a32dc..17a82f4 100644
@@ -13,8 +13,7 @@ def preprocess_image(test, params):
     @note: Currently this function just creates an image if requested.
     """
     qemu_img_path = os.path.join(test.bindir, "qemu-img")
-    image_dir = os.path.join(test.bindir, "images")
-    image_filename = kvm_vm.get_image_filename(params, image_dir)
+    image_filename = kvm_vm.get_image_filename(params, test.bindir)
 
     create_image = False
 
@@ -27,7 +26,7 @@ def preprocess_image(test, params):
         create_image = True
 
     if create_image:
-        if not kvm_vm.create_image(params, qemu_img_path, image_dir):
+        if not kvm_vm.create_image(params, qemu_img_path, test.bindir):
             message = "Could not create image"
             logging.error(message)
             raise error.TestError(message)
@@ -44,9 +43,6 @@ def preprocess_vm(test, params, env, name):
     @param name: The name of the VM object.
     """
     qemu_path = os.path.join(test.bindir, "qemu")
-    image_dir = os.path.join(test.bindir, "images")
-    iso_dir = os.path.join(test.bindir, "isos")
-    script_dir = test.bindir
 
     logging.debug("Preprocessing VM '%s'..." % name)
     vm = kvm_utils.env_get_vm(env, name)
@@ -54,7 +50,7 @@ def preprocess_vm(test, params, env, name):
         logging.debug("VM object found in environment")
     else:
         logging.debug("VM object does not exist; creating it")
-        vm = kvm_vm.VM(name, params, qemu_path, image_dir, iso_dir, script_dir,
+        vm = kvm_vm.VM(name, params, qemu_path, test.bindir,
                        env.get("address_cache"))
         kvm_utils.env_register_vm(env, name, vm)
 
@@ -75,16 +71,13 @@ def preprocess_vm(test, params, env, name):
             start_vm = True
         elif vm.make_qemu_command() != vm.make_qemu_command(name, params,
                                                             qemu_path,
-                                                            image_dir,
-                                                            iso_dir,
-                                                            script_dir):
+                                                            test.bindir):
             logging.debug("VM's qemu command differs from requested one; "
                           "restarting it...")
             start_vm = True
 
     if start_vm:
-        if not vm.create(name, params, qemu_path, image_dir, iso_dir,
-                         script_dir, for_migration):
+        if not vm.create(name, params, qemu_path, test.bindir, for_migration):
             message = "Could not start VM"
             logging.error(message)
             raise error.TestError(message)
@@ -101,10 +94,8 @@ def postprocess_image(test, params):
     @param test: An Autotest test object.
     @param params: A dict containing image postprocessing parameters.
     """
-    image_dir = os.path.join(test.bindir, "images")
-
     if params.get("remove_image") == "yes":
-        kvm_vm.remove_image(params, image_dir)
+        kvm_vm.remove_image(params, test.bindir)
 
 
 def postprocess_vm(test, params, env, name):
client/tests/kvm/kvm_tests.cfg.sample +5 -0
index 8238f3e..baebd64 100644
@@ -634,5 +634,10 @@ variants:
 include kvm_cdkeys.cfg
 
 
+image_name.* ?<= images/
+cdrom.* ?<= isos/
+steps ?<= steps/
+
+
 # Choose your test list
 only fc8_quick
client/tests/kvm/kvm_vm.py +38 -68

251 lines not on this page · raw message

client/tests/kvm/stepmaker.py +1 -1
index 8f16ffd..6f1e6a1 100644
@@ -349,7 +349,7 @@ def run_stepmaker(test, params, env):
     steps_filename = params.get("steps")
     if not steps_filename:
         raise error.TestError("Steps filename not specified")
-    steps_filename = os.path.join(test.bindir, "steps", steps_filename)
+    steps_filename = kvm_utils.get_path(test.bindir, steps_filename)
     if os.path.exists(steps_filename):
         raise error.TestError("Steps file %s already exists" % steps_filename)
 
Signature · 1 line
1.5.4.1
#6 lore raw

PATCH 6/6 KVM test: allow the user to specify the paths of the qemu and qemu-img binaries

Currently, qemu and qemu-img are accessed via symlinks that must be present in test.bindir (the KVM test dir).

This patch adds new parameters qemu_binary and qemu_img_binary, which specify the paths of the qemu and qemu-img binaries.
They may be absolute paths or relative to test.bindir (the KVM test dir). In kvm_tests.cfg.sample they are set to 'qemu' and 'qemu-img', which means the binaries are expected to be found in test.bindir, which is the current behavior.

Adding these parameters results in slightly cleaner code, but also allows for some more flexibility in defining tests. For example, the user can 'variant' on the parameter qemu_binary, i.e. define several variants of a test set that differ only in this parameter. This will make the test set run several times, each time using a different pre-installed version of qemu. The parameters also make it possible to use pre-installed qemu and qemu-img that reside somewhere outside the Autotest dir, e.g. in /usr/bin.

---
 client/tests/kvm/kvm_preprocessing.py |   18 +++++++-----------
 client/tests/kvm/kvm_tests.cfg.sample |    2 ++
 client/tests/kvm/kvm_vm.py            |   33 ++++++++++-----------------------
 3 files changed, 19 insertions(+), 34 deletions(-)
client/tests/kvm/kvm_preprocessing.py +7 -11
index 17a82f4..7c16305 100644
@@ -12,7 +12,6 @@ def preprocess_image(test, params):
     @param params: A dict containing image preprocessing parameters.
     @note: Currently this function just creates an image if requested.
     """
-    qemu_img_path = os.path.join(test.bindir, "qemu-img")
     image_filename = kvm_vm.get_image_filename(params, test.bindir)
 
     create_image = False
@@ -20,13 +19,13 @@ def preprocess_image(test, params):
     if params.get("force_create_image") == "yes":
         logging.debug("'force_create_image' specified; creating image...")
         create_image = True
-    elif params.get("create_image") == "yes" and not \
-    os.path.exists(image_filename):
+    elif (params.get("create_image") == "yes" and not 
+          os.path.exists(image_filename)):
         logging.debug("Creating image...")
         create_image = True
 
     if create_image:
-        if not kvm_vm.create_image(params, qemu_img_path, test.bindir):
+        if not kvm_vm.create_image(params, test.bindir):
             message = "Could not create image"
             logging.error(message)
             raise error.TestError(message)
@@ -42,16 +41,13 @@ def preprocess_vm(test, params, env, name):
     @param env: The environment (a dict-like object).
     @param name: The name of the VM object.
     """
-    qemu_path = os.path.join(test.bindir, "qemu")
-
     logging.debug("Preprocessing VM '%s'..." % name)
     vm = kvm_utils.env_get_vm(env, name)
     if vm:
         logging.debug("VM object found in environment")
     else:
         logging.debug("VM object does not exist; creating it")
-        vm = kvm_vm.VM(name, params, qemu_path, test.bindir,
-                       env.get("address_cache"))
+        vm = kvm_vm.VM(name, params, test.bindir, env.get("address_cache"))
         kvm_utils.env_register_vm(env, name, vm)
 
     start_vm = False
@@ -70,14 +66,13 @@ def preprocess_vm(test, params, env, name):
             logging.debug("VM is not alive; starting it...")
             start_vm = True
         elif vm.make_qemu_command() != vm.make_qemu_command(name, params,
-                                                            qemu_path,
                                                             test.bindir):
             logging.debug("VM's qemu command differs from requested one; "
                           "restarting it...")
             start_vm = True
 
     if start_vm:
-        if not vm.create(name, params, qemu_path, test.bindir, for_migration):
+        if not vm.create(name, params, test.bindir, for_migration):
             message = "Could not start VM"
             logging.error(message)
             raise error.TestError(message)
@@ -247,7 +242,8 @@ def preprocess(test, params, env):
 
     # Get the KVM userspace version and write it as a keyval
     logging.debug("Fetching KVM userspace version...")
-    qemu_path = os.path.join(test.bindir, "qemu")
+    qemu_path = kvm_utils.get_path(test.bindir, params.get("qemu_binary",
+                                                           "qemu"))
     version_line = commands.getoutput("%s -help | head -n 1" % qemu_path)
     exp = re.compile("[Vv]ersion .*?,")
     match = exp.search(version_line)
client/tests/kvm/kvm_tests.cfg.sample +2 -0
index baebd64..74901a6 100644
@@ -15,6 +15,8 @@ kill_vm = no
 kill_vm_gracefully = yes
 
 # Some default VM params
+qemu_binary = qemu
+qemu_img_binary = qemu-img
 mem = 512
 image_size = 10G
 shell_port = 22
client/tests/kvm/kvm_vm.py +10 -23
index b2f0345..9016ed3 100644
@@ -27,12 +27,11 @@ def get_image_filename(params, root_dir):
     return image_filename
 
 
-def create_image(params, qemu_img_path, root_dir):
+def create_image(params, root_dir):
     """
     Create an image using qemu_image.
 
     @param params: Dictionary containing the test parameters.
-    @param qemu_img_path: The path of the qemu-img binary
     @param root_dir: Base directory for relative filenames.
 
     @note: params should contain:
@@ -41,7 +40,8 @@ def create_image(params, qemu_img_path, root_dir):
            image_size -- the requested size of the image (a string
            qemu-img can understand, such as '10G')
     """
-    qemu_img_cmd = qemu_img_path
+    qemu_img_cmd = kvm_utils.get_path(root_dir, params.get("qemu_img_binary",
+                                                           "qemu-img"))
     qemu_img_cmd += " create"
 
     format = params.get("image_format", "qcow2")
@@ -100,14 +100,13 @@ class VM:
     This class handles all basic VM operations.
     """
 
-    def __init__(self, name, params, qemu_path, root_dir, address_cache):
+    def __init__(self, name, params, root_dir, address_cache):
         """
         Initialize the object and set a few attributes.
 
         @param name: The name of the object
         @param params: A dict containing VM params
                 (see method make_qemu_command for a full description)
-        @param qemu_path: The path of the qemu binary
         @param root_dir: Base directory for relative filenames
         @param address_cache: A dict that maps MAC addresses to IP addresses
         """
@@ -118,7 +117,6 @@ class VM:
 
         self.name = name
         self.params = params
-        self.qemu_path = qemu_path
         self.root_dir = root_dir
         self.address_cache = address_cache
 
@@ -133,8 +131,7 @@ class VM:
                 break
 
 
-    def clone(self, name=None, params=None, qemu_path=None, root_dir=None,
-              address_cache=None):
+    def clone(self, name=None, params=None, root_dir=None, address_cache=None):
         """
         Return a clone of the VM object with optionally modified parameters.
         The clone is initially not alive and needs to be started using create().
@@ -143,7 +140,6 @@ class VM:
 
         @param name: Optional new VM name
         @param params: Optional new VM creation parameters
-        @param qemu_path: Optional new path to qemu
         @param root_dir: Optional new base directory for relative filenames
         @param address_cache: A dict that maps MAC addresses to IP addresses
         """
@@ -151,17 +147,14 @@ class VM:
             name = self.name
         if params == None:
             params = self.params.copy()
-        if qemu_path == None:
-            qemu_path = self.qemu_path
         if root_dir == None:
             root_dir = self.root_dir
         if address_cache == None:
             address_cache = self.address_cache
-        return VM(name, params, qemu_path, root_dir, address_cache)
+        return VM(name, params, root_dir, address_cache)
 
 
-    def make_qemu_command(self, name=None, params=None, qemu_path=None,
-                          root_dir=None):
+    def make_qemu_command(self, name=None, params=None, root_dir=None):
         """
         Generate a qemu command line. All parameters are optional. If a
         parameter is not supplied, the corresponding value stored in the
@@ -169,7 +162,6 @@ class VM:
 
         @param name: The name of the object
         @param params: A dict containing VM params
-        @param qemu_path: The path of the qemu binary
         @param root_dir: Base directory for relative filenames
 
         @note: The params dict should contain:
@@ -202,8 +194,6 @@ class VM:
             name = self.name
         if params == None:
             params = self.params
-        if qemu_path == None:
-            qemu_path = self.qemu_path
         if root_dir == None:
             root_dir = self.root_dir
 
@@ -213,7 +203,8 @@ class VM:
         if params.get("x11_display"):
             qemu_cmd += "DISPLAY=%s " % params.get("x11_display")
         # Add the qemu binary
-        qemu_cmd += qemu_path
+        qemu_cmd += kvm_utils.get_path(root_dir, params.get("qemu_binary",
+                                                            "qemu"))
         # Add the VM's name
         qemu_cmd += " -name '%s'" % name
         # Add the monitor socket parameter
@@ -295,7 +286,7 @@ class VM:
         return qemu_cmd
 
 
-    def create(self, name=None, params=None, qemu_path=None, root_dir=None,
+    def create(self, name=None, params=None, root_dir=None,
                for_migration=False, timeout=5.0):
         """
         Start the VM by running a qemu command.
@@ -306,7 +297,6 @@ class VM:
 
         @param name: The name of the object
         @param params: A dict containing VM params
-        @param qemu_path: The path of the qemu binary
         @param root_dir: Base directory for relative filenames
         @param for_migration: If True, start the VM with the -incoming
         option
@@ -317,13 +307,10 @@ class VM:
             self.name = name
         if params != None:
             self.params = params
-        if qemu_path != None:
-            self.qemu_path = qemu_path
         if root_dir != None:
             self.root_dir = root_dir
         name = self.name
         params = self.params
-        qemu_path = self.qemu_path
         root_dir = self.root_dir
 
         # Verify the md5sum of the ISO image
Signature · 1 line
1.5.4.1
#7 lore raw
In reply to Michael Goldish

Due to the order I've applied some patchsets, I had to rebase the first patch, then tested the changes. Everything looks good, all changes on this patchset commited.

http://autotest.kernel.org/changeset/3545
http://autotest.kernel.org/changeset/3546
http://autotest.kernel.org/changeset/3547
http://autotest.kernel.org/changeset/3548
http://autotest.kernel.org/changeset/3549
http://autotest.kernel.org/changeset/3550

Thanks, Michael!

Quoted 11 lines · Michael Goldish

This patch set modifies the names and functionality of several config parameters and adds new ones.
It also adds support for Netcat as a remote shell client.

It breaks compatibility with existing test configurations.
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Signature · 1 line
Lucas Meneghel