KVM test: Removing qemu/qemu-kvm variants from tests
PATCH 1/6 KVM test: Removing qemu/qemu-kvm variants from tests
The idea of having a qemu/qemu-kvm variants block turned out to be a bad idea, since we are never meant to run them in combination. So let's roll back this change and give some examples on tests.cfg.
Also, cleaned up tests.cfg.sample, and introduced Fedora 12 as the default host, as it is the latest Fedora upstream.
--- client/tests/kvm/tests.cfg.sample | 48 ++++++-------------------------- client/tests/kvm/tests_base.cfg.sample | 8 ----- 2 files changed, 9 insertions(+), 47 deletions(-)
client/tests/kvm/tests.cfg.sample +9 -39
@@ -20,66 +20,36 @@ include cdkeys.cfg #cdrom.* ?<= /tmp/kvm_autotest_root/ #steps ?<= /tmp/kvm_autotest_root/ -# You will notice that in all test definition blocks we have 'only qemu-kvm' -# set. This means that qemu-kvm command line syntax will be used. If you -# intend to test qemu upstream, you'll have to change that to 'only qemu'. variants: - @full: - only qemu-kvm - - @sample1: - only qemu-kvm - only no_pci_assignable - only Fedora Windows - - @sample2: + - @fc12_qemu: only qemu-kvm only qcow2 only ide only default only up only no_pci_assignable - only Fedora.9.* RHEL.5.* Windows - only rtl8139 - - @sample3: - only qemu-kvm - only no_pci_assignable - only qcow2.*ide.*default.*up.*Ubuntu-8.10-server.*(autotest.sleeptest) - only rtl8139 - - @fc8_step: - only qemu-kvm - only qcow2 - only ide - only default - only up - only no_pci_assignable - only Fedora.8.32 - only install setup boot shutdown - only rtl8139 - only hugepages - - @winXP_32_unattended: - only qemu-kvm - only qcow2 - only ide - only default - only up - only no_pci_assignable - only WinXP.32 + only Fedora.12.64 no install setup no hugepages only unattended_install boot shutdown only rtl8139 - - @fc11_kickstart: + # The only change needed to test qemu upstream + # instead of qemu-kvm is the explicit -enable-kvm + # that has to be passed to the command line + extra_params = ' -enable-kvm' + - @fc12_qemu_kvm: only qemu-kvm only qcow2 only ide only default only up only no_pci_assignable - only Fedora.11.64 + only Fedora.12.64 no install setup no hugepages only unattended_install boot shutdown only rtl8139 # Choose your test list from the testsets defined -only fc11_kickstart - +only fc12_qemu_kvm
client/tests/kvm/tests_base.cfg.sample +0 -8
@@ -62,8 +62,6 @@ variants: - unattended_install: type = unattended_install - # Unattended install also perform guest setup, so setup is not needed - no setup kill_vm_on_error = yes force_create_image = yes pre_command = scripts/unattended.py
@@ -894,12 +892,6 @@ linux_s3: variants: - - @qemu-kvm: - - qemu: - extra_params += " -enable-kvm" - - -variants: - @up: no autotest.npb - smp2:
Signature · 1 line
1.6.6
PATCH 2/6 KVM test: Define defaults for KVM test
Define reasonable defaults for the kvm test, to make it easier to start using KVM autotest and encourage people to play with it. The defaults are:
* qemu and qemu-kvm are expected to be found under /usr/bin.
* The auxiliary directories are expected to be found under /tmp/kvm_autotest_root, since some people might want to use a nfs share to provide cds.
A first time config script will be provided to assist people creating their first kvm test setup so it can be done answering a few questions and leaving the heavy lifting to the script.
--- client/tests/kvm/tests.cfg.sample | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-)
client/tests/kvm/tests.cfg.sample +7 -8
@@ -6,19 +6,18 @@ include cdkeys.cfg # Modify/comment the following lines if you wish to modify # the paths of the image files, ISO files, step files or qemu binaries. -# If you keep these lines commented, all mentioned paths are expected -# to be found in the KVM test dir (tests/kvm/). -# On the example below: +# +# As for the defaults: # * qemu and qemu-img are expected to be found under /usr/bin/qemu-kvm and # /usr/bin/qemu-img respectively. # * All image files are expected under /tmp/kvm_autotest_root/images/ # * All iso files are expected under /tmp/kvm_autotest_root/isos/ # * All step files are expected under /tmp/kvm_autotest_root/steps/ -#qemu_binary = /usr/bin/qemu-kvm -#qemu_img_binary = /usr/bin/qemu-img -#image_name.* ?<= /tmp/kvm_autotest_root/ -#cdrom.* ?<= /tmp/kvm_autotest_root/ -#steps ?<= /tmp/kvm_autotest_root/ +qemu_binary = /usr/bin/qemu-kvm +qemu_img_binary = /usr/bin/qemu-img +image_name.* ?<= /tmp/kvm_autotest_root/ +cdrom.* ?<= /tmp/kvm_autotest_root/ +steps ?<= /tmp/kvm_autotest_root/ variants: - @full:
Signature · 1 line
1.6.6
PATCH 3/6 KVM test: Make sure reset and shutdown are the last ones
system_reset, system_powerdown and shutdown *must* be the last ones defined, since the effect of such tests can leave the VM on a bad state.
--- client/tests/kvm/tests_base.cfg.sample | 35 +++++++++++++++++-------------- 1 files changed, 19 insertions(+), 16 deletions(-)
client/tests/kvm/tests_base.cfg.sample +19 -16
@@ -236,6 +236,24 @@ variants: - fmt_raw: image_format_stg = raw + - vlan_tag: install setup unattended_install + type = vlan_tag + # subnet should not be used by host + subnet = 192.168.123 + vlans = "10 20" + nic_mode = tap + vms += " vm2" + extra_params_vm1 += " -snapshot" + extra_params_vm2 += " -snapshot" + kill_vm_gracefully_vm2 = no + address_index_vm2 = 1 + + - physical_resources_check: install setup unattended_install + type = physical_resources_check + catch_uuid_cmd = dmidecode | awk -F: '/UUID/ {print $2}' + + # system_reset, system_powerdown and shutdown *must* be the last ones + # defined, since the effect of such tests can leave the VM on a bad state. - system_reset: install setup unattended_install type = boot reboot_method = system_reset
@@ -254,22 +272,7 @@ variants: shutdown_method = shell kill_vm = yes kill_vm_gracefully = no - - - vlan_tag: install setup unattended_install - type = vlan_tag - # subnet should not be used by host - subnet = 192.168.123 - vlans = "10 20" - nic_mode = tap - vms += " vm2" - extra_params_vm1 += " -snapshot" - extra_params_vm2 += " -snapshot" - kill_vm_gracefully_vm2 = no - address_index_vm2 = 1 - - - physical_resources_check: install setup unattended_install - type = physical_resources_check - catch_uuid_cmd = dmidecode | awk -F: '/UUID/ {print $2}' + # Do not define test variants below shutdown # NICs variants:
Signature · 1 line
1.6.6
PATCH 5/6 KVM test: Getting rid of annoying deprecation message
In reply to Lucas Meneghel RodriguesWhen using python > 2.5, use the recommended hashlib. When using python 2.4, fall back to the md5 and sha modules.
--- client/tests/kvm/kvm_utils.py | 18 ++++++++++++++---- client/tests/kvm/ppm_utils.py | 12 +++++++++--- client/tests/kvm/tests/steps.py | 2 +- 3 files changed, 24 insertions(+), 8 deletions(-)
client/tests/kvm/kvm_utils.py +14 -4
@@ -4,10 +4,14 @@ KVM test utility functions. @copyright: 2008-2009 Red Hat Inc. """ -import md5, sha, thread, subprocess, time, string, random, socket, os, signal +import thread, subprocess, time, string, random, socket, os, signal +try: + import hashlib +except ImportError: + import md5, sha import select, re, logging, commands, cPickle, pty from autotest_lib.client.bin import utils -from autotest_lib.client.common_lib import error +from autotest_lib.client.common_lib import error, logging_config import kvm_subprocess
@@ -789,9 +793,15 @@ def hash_file(filename, size=None, method="md5"): f = open(filename, 'rb') if method == "md5": - hash = md5.new() + try: + hash = hashlib.new('md5') + except NameError: + hash = md5.new() elif method == "sha1": - hash = sha.new() + try: + hash = hashlib.new('sha1') + except NameError: + hash = sha.new() else: logging.error("Unknown hash type %s, returning None" % method) return None
client/tests/kvm/ppm_utils.py +9 -3
@@ -4,8 +4,11 @@ Utility functions to deal with ppm (qemu screendump format) files. @copyright: Red Hat 2008-2009 """ -import md5, os, struct, time, re - +import os, struct, time, re +try: + import hashlib +except ImportError: + import md5 # Some directory/filename utils, for consistency
@@ -120,7 +123,10 @@ def image_md5sum(width, height, data): @data: PPM file data """ header = "P6\n%d %d\n255\n" % (width, height) - md5obj = md5.new(header) + try: + md5obj = hashlib.md5(header) + except NameError: + md5obj = md5.new(header) md5obj.update(data) return md5obj.hexdigest()
client/tests/kvm/tests/steps.py +1 -1
@@ -4,7 +4,7 @@ Utilities to perform automatic guest installation using step files. @copyright: Red Hat 2008-2009 """ -import os, time, md5, re, shutil, logging +import os, time, re, shutil, logging from autotest_lib.client.common_lib import utils, error import kvm_utils, ppm_utils, kvm_subprocess try:
Signature · 1 line
1.6.6
PATCH 4/6 KVM test: Moving KvmLogging utility class to kvm_utils
In reply to Lucas Meneghel RodriguesSome of the auxiliary kvm test programs need to use logging configuration, we ended up duplicating code across the test. Move the duplicated instances to a single one living in kvm_utils.py.
--- client/tests/kvm/cd_hash.py | 7 +------ client/tests/kvm/kvm_config.py | 8 +------- client/tests/kvm/kvm_utils.py | 10 ++++++++++ 3 files changed, 12 insertions(+), 13 deletions(-)
client/tests/kvm/cd_hash.py +1 -6
@@ -10,11 +10,6 @@ import common, kvm_utils from autotest_lib.client.common_lib import logging_config, logging_manager -class KvmLoggingConfig(logging_config.LoggingConfig): - def configure_logging(self, results_dir=None, verbose=False): - super(KvmLoggingConfig, self).configure_logging(use_console=True, - verbose=verbose) - if __name__ == "__main__": parser = optparse.OptionParser() parser.add_option('-i', '--iso', type="string", dest="filename",
@@ -25,7 +20,7 @@ if __name__ == "__main__": options, args = parser.parse_args() filename = options.filename - logging_manager.configure_logging(KvmLoggingConfig()) + logging_manager.configure_logging(kvm_utils.KvmLoggingConfig()) if not filename: parser.print_help()
client/tests/kvm/kvm_config.py +1 -7
@@ -11,12 +11,6 @@ from autotest_lib.client.common_lib import error from autotest_lib.client.common_lib import logging_config, logging_manager -class KvmLoggingConfig(logging_config.LoggingConfig): - def configure_logging(self, results_dir=None, verbose=False): - super(KvmLoggingConfig, self).configure_logging(use_console=True, - verbose=verbose) - - class config: """ Parse an input file or string that follows the KVM Test Config File format
@@ -517,7 +511,7 @@ if __name__ == "__main__": # Here we configure the stand alone program to use the autotest # logging system. - logging_manager.configure_logging(KvmLoggingConfig(), verbose=debug) + logging_manager.configure_logging(kvm_utils.KvmLoggingConfig(), verbose=debug) list = config(filename, debug=debug).get_list() i = 0 for dict in list:
client/tests/kvm/kvm_utils.py +10 -0
@@ -970,6 +970,16 @@ def get_vendor_from_pci_id(pci_id): return re.sub(":", " ", commands.getoutput(cmd)) +class KvmLoggingConfig(logging_config.LoggingConfig): + """ + Used with the sole purpose of providing convenient logging setup + for the KVM test auxiliary programs. + """ + def configure_logging(self, results_dir=None, verbose=False): + super(KvmLoggingConfig, self).configure_logging(use_console=True, + verbose=verbose) + + class PciAssignable(object): """ Request PCI assignable devices on host. It will check whether to request
Signature · 1 line
1.6.6
PATCH 6/6 KVM test: Add a get_started.py script
In reply to Lucas Meneghel RodriguesIn order to make it easier to get started with KVM testing, add a script that helps with setting up directories, paths and iso files for the default test configuration (Fedora 12 guest install, boot test, shutdown). Once the first idea of how things work is formed, one may start to tinker with configuration files.
Added pointers to the online documentation.
--- client/tests/kvm/README | 19 +++++++- client/tests/kvm/get_started.py | 103 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+), 1 deletions(-) create mode 100755 client/tests/kvm/get_started.py
client/tests/kvm/README +18 -1
@@ -1,3 +1,20 @@ -In order to get started, please refer to the online documentation: +For the impatient: + +Execute the get_started.py script located on this directory, +that will guide you through setting up the default kvm test +scenario: + + * Guest install with Fedora 12 + * Boot, reboot and shutdown test + +The script will help you to create all the directories, and +even get the OS iso in case you don't have it yet. + +For the not so impatient: + +You are *strongly* advised to read the online docs: http://www.linux-kvm.org/page/KVM-Autotest/Client_Install + +So you can have a better idea of how the test is organized +and how it works.
client/tests/kvm/get_started.py new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
1.6.6
Quoted 33 lines · ----- "Lucas Meneghel Rodrigues
The idea of having a qemu/qemu-kvm variants block turned out to be a bad idea, since we are never meant to run them in combination. So let's roll back this change and give some examples on tests.cfg.
Also, cleaned up tests.cfg.sample, and introduced Fedora 12 as the default host, as it is the latest Fedora upstream.
Signed-off-by Lucas Meneghel Rodrigues <[email protected]>--- client/tests/kvm/tests.cfg.sample | 48 ++++++-------------------------- client/tests/kvm/tests_base.cfg.sample | 8 ----- 2 files changed, 9 insertions(+), 47 deletions(-)client/tests/kvm/tests.cfg.sample +0
-1@@ -20,66 +20,36 @@ include cdkeys.cfg #cdrom.* ?<= /tmp/kvm_autotest_root/ #steps ?<= /tmp/kvm_autotest_root/ -# You will notice that in all test definition blocks we have 'onlyqemu-kvm'
-# set. This means that qemu-kvm command line syntax will be used. If you
-# intend to test qemu upstream, you'll have to change that to 'only qemu'.
variants:
- @full:
client/tests/kvm/tests.cfg.sample include cdkeys.cfg · line 26
Quoted 8 lines
client/tests/kvm/tests.cfg.sample +1
-6- only qemu-kvm - - @sample1: - only qemu-kvm - only no_pci_assignable - only Fedora Windows - - @sample2: + - @fc12_qemu: only qemu-kvm
Didn't you mean to remove this line?
Quoted 34 lines
only qcow2
only ide
only default
only up
onlyno_pci_assignableclient/tests/kvm/tests.cfg.sample +0
-6- only Fedora.9.* RHEL.5.* Windows - only rtl8139 - - @sample3: - only qemu-kvm - only no_pci_assignable - onlyqcow2.*ide.*default.*up.*Ubuntu-8.10-server.*(autotest.sleeptest)
client/tests/kvm/tests.cfg.sample +1
-20- only rtl8139 - - @fc8_step: - only qemu-kvm - only qcow2 - only ide - only default - only up - only no_pci_assignable - only Fedora.8.32 - only install setup boot shutdown - only rtl8139 - only hugepages - - @winXP_32_unattended: - only qemu-kvm - only qcow2 - only ide - only default - only up - only no_pci_assignable - only WinXP.32 + only Fedora.12.64 no install setup
client/tests/kvm/tests.cfg.sample include cdkeys.cfg · line 42
Quoted 10 lines
client/tests/kvm/tests.cfg.sample +5
-1no hugepages only unattended_install boot shutdown only rtl8139 - - @fc11_kickstart: + # The only change needed to test qemu upstream + # instead of qemu-kvm is the explicit -enable-kvm + # that has to be passed to the command line + extra_params = ' -enable-kvm' + - @fc12_qemu_kvm: only qemu-kvm
Same here.
Quoted 51 lines
only qcow2
only ide
only default
only up
onlyno_pci_assignableclient/tests/kvm/tests.cfg.sample +2
-3- only Fedora.11.64 + only Fedora.12.64 no install setup no hugepages only unattended_install boot shutdown only rtl8139 # Choose your test list from the testsets defined -only fc11_kickstart - +only fc12_qemu_kvmclient/tests/kvm/tests_base.cfg.sample +0
-1@@ -62,8 +62,6 @@ variants: - unattended_install: type = unattended_install - # Unattended install also perform guest setup, so setup isnot needed
client/tests/kvm/tests_base.cfg.sample +0
-7- no setup kill_vm_on_error = yes force_create_image = yes pre_command = scripts/unattended.py@@ -894,12 +892,6 @@ linux_s3: variants: - - @qemu-kvm: - - qemu: - extra_params += " -enable-kvm" - - -variants: - @up: no autotest.npb - smp2:Signature · 6 lines
1.6.6 -- 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
Quoted 37 lines · Michael Goldish
Quoted 35 lines · ----- "Lucas Meneghel Rodrigues
The idea of having a qemu/qemu-kvm variants block turned out to be a bad idea, since we are never meant to run them in combination. So let's roll back this change and give some examples on tests.cfg.
Also, cleaned up tests.cfg.sample, and introduced Fedora 12 as the default host, as it is the latest Fedora upstream.
Signed-off-by Lucas Meneghel Rodrigues <[email protected]>--- client/tests/kvm/tests.cfg.sample | 48 ++++++-------------------------- client/tests/kvm/tests_base.cfg.sample | 8 ----- 2 files changed, 9 insertions(+), 47 deletions(-)client/tests/kvm/tests.cfg.sample +0
-1@@ -20,66 +20,36 @@ include cdkeys.cfg #cdrom.* ?<= /tmp/kvm_autotest_root/ #steps ?<= /tmp/kvm_autotest_root/ -# You will notice that in all test definition blocks we have 'onlyqemu-kvm'
-# set. This means that qemu-kvm command line syntax will be used. If you
-# intend to test qemu upstream, you'll have to change that to 'only qemu'.
variants:
- @full:client/tests/kvm/tests.cfg.sample +0
-2- only qemu-kvm - - @sample1:
Quoted 8 lines
client/tests/kvm/tests.cfg.sample include cdkeys.cfg · line 26
Quoted 6 lines
client/tests/kvm/tests.cfg.sample +1
-4- only qemu-kvm - only no_pci_assignable - only Fedora Windows - - @sample2: + - @fc12_qemu: only qemu-kvmDidn't you mean to remove this line?
Yes, will fix both on a later version of the patch.
It occurred to me that it is a good idea to ship more pre-canned test sets, which contain windows and some other test scenarios.
Re: [PATCH 3/6] KVM test: Make sure reset and shutdown are the last ones
In reply to Lucas Meneghel RodriguesQuoted 36 lines · ----- "Lucas Meneghel Rodrigues
system_reset,system_powerdownand shutdown *must* be the last ones defined, since the effect of such tests can leave the VM on a bad state.Signed-off-by Lucas Meneghel Rodrigues <[email protected]>--- client/tests/kvm/tests_base.cfg.sample | 35 +++++++++++++++++-------------- 1 files changed, 19 insertions(+), 16 deletions(-)client/tests/kvm/tests_base.cfg.sample +17
-0@@ -236,6 +236,24 @@ variants: - fmt_raw: image_format_stg = raw + - vlan_tag: install setup unattended_install + type = vlan_tag + # subnet should not be used by host + subnet = 192.168.123 + vlans = "10 20" + nic_mode = tap + vms += " vm2" + extra_params_vm1 += " -snapshot" + extra_params_vm2 += " -snapshot" + kill_vm_gracefully_vm2 = no + address_index_vm2 = 1 + + - physical_resources_check: install setup unattended_install + type = physical_resources_check + catch_uuid_cmd = dmidecode | awk -F: '/UUID/ {print $2}' + + # system_reset, system_powerdown and shutdown *must* be the last
Quoted 3 lines
ones
+ # defined, since the effect of such tests can leave the VM on a
bad state.
I think the order should be system_powerdown, system_reset, shutdown. We should minimize the number of tests running after system_reset.
Quoted 34 lines
-
system_reset: install setupunattended_installtype = boot
reboot_method=system_resetclient/tests/kvm/tests_base.cfg.sample +1
-16@@ -254,22 +272,7 @@ variants: shutdown_method = shell kill_vm = yes kill_vm_gracefully = no - - - vlan_tag: install setup unattended_install - type = vlan_tag - # subnet should not be used by host - subnet = 192.168.123 - vlans = "10 20" - nic_mode = tap - vms += " vm2" - extra_params_vm1 += " -snapshot" - extra_params_vm2 += " -snapshot" - kill_vm_gracefully_vm2 = no - address_index_vm2 = 1 - - - physical_resources_check: install setup unattended_install - type = physical_resources_check - catch_uuid_cmd = dmidecode | awk -F: '/UUID/ {print $2}' + # Do not define test variants below shutdown # NICs variants:Signature · 6 lines
1.6.6 _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest