diff mbox

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

Message ID 1279209458-19590-2-git-send-email-mgoldish@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Goldish July 15, 2010, 3:57 p.m. UTC
None
diff mbox

Patch

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