[KVM-AUTOTEST PATCH 2/9] KVM test: allow definition of multiple cdroms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of using 'cdrom_extra', define 'cdroms' similarly to 'images'.
Also set -drive indices for cd1 and image1.
Also fix regular expression in tests.cfg.sample, so it doesn't match 'cdroms'
when it shouldn't.

Note: if you use your own tests.cfg, you should change the line

cdrom.* ?<= ...

to

cdrom(_.*)? ?<= ...

It won't hurt to do the same for image_name.

Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/kvm_vm.py             |   19 +++++++------------
 client/tests/kvm/tests.cfg.sample      |    4 ++--
 client/tests/kvm/tests_base.cfg.sample |   10 ++++++++--
 3 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index 248aeca..bdc9aab 100755
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -414,18 +414,13 @@ class VM:
         if smp:
             qemu_cmd += add_smp(help, smp)
 
-        iso = params.get("cdrom")
-        if iso:
-            iso = kvm_utils.get_path(root_dir, iso)
-            qemu_cmd += add_cdrom(help, iso, 2)
-
-        # Even though this is not a really scalable approach,
-        # it doesn't seem like we are going to need more than
-        # 2 CDs active on the same VM.
-        iso_extra = params.get("cdrom_extra")
-        if iso_extra:
-            iso_extra = kvm_utils.get_path(root_dir, iso_extra)
-            qemu_cmd += add_cdrom(help, iso_extra, 3)
+        cdroms = kvm_utils.get_sub_dict_names(params, "cdroms")
+        for cdrom in cdroms:
+            cdrom_params = kvm_utils.get_sub_dict(params, cdrom)
+            iso = cdrom_params.get("cdrom")
+            if iso:
+                qemu_cmd += add_cdrom(help, kvm_utils.get_path(root_dir, iso),
+                                      cdrom_params.get("drive_index"))
 
         # We may want to add {floppy_otps} parameter for -fda
         # {fat:floppy:}/path/. However vvfat is not usually recommended.
diff --git a/client/tests/kvm/tests.cfg.sample b/client/tests/kvm/tests.cfg.sample
index 6d5f244..e01406e 100644
--- a/client/tests/kvm/tests.cfg.sample
+++ b/client/tests/kvm/tests.cfg.sample
@@ -13,8 +13,8 @@ include cdkeys.cfg
 # * All image files are expected under /tmp/kvm_autotest_root/images/
 # * All iso files are expected under /tmp/kvm_autotest_root/isos/
 qemu_img_binary = /usr/bin/qemu-img
-image_name.* ?<= /tmp/kvm_autotest_root/images/
-cdrom.* ?<= /tmp/kvm_autotest_root/isos/
+image_name(_.*)? ?<= /tmp/kvm_autotest_root/images/
+cdrom(_.*)? ?<= /tmp/kvm_autotest_root/isos/
 
 # Here are the test sets variants. The variant 'qemu_kvm_windows_quick' is
 # fully commented, the following ones have comments only on noteworthy points
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index c2def29..d0b8acb 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -3,9 +3,10 @@
 # Define the objects we'll be using
 vms = vm1
 images = image1
+cdroms = cd1
 nics = nic1
 monitors = humanmonitor1
-login_timeout = 360
+
 # Choose the main VM and monitor
 main_vm = vm1
 main_monitor = humanmonitor1
@@ -33,8 +34,10 @@ qemu_img_binary = qemu-img
 smp = 1
 mem = 512
 image_size = 10G
+drive_index_image1 = 0
 shell_port = 22
 display = vnc
+drive_index_cd1 = 2
 
 # Monitor params
 monitor_type = human
@@ -56,6 +59,7 @@ run_tcpdump = yes
 
 # Misc
 profilers = kvm_stat
+login_timeout = 360
 
 
 # Tests
@@ -1044,7 +1048,9 @@ variants:
         unattended_install.cdrom:
             timeout = 7200
             finish_program = deps/finish.exe
-            cdrom_extra = windows/winutils.iso
+            cdroms += " extracd"
+            cdrom_extracd = windows/winutils.iso
+            drive_index_extracd = 3
         migrate:
             migration_test_command = ver && vol
             migration_bg_command = start ping -t localhost
-- 
1.5.4.1

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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux