KVM test: allow definition of multiple cdroms
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.
git-svn-id: http://test.kernel.org/svn/autotest/trunk@4728 592f7852-d20e-0410-864c-8624ca9c26a4
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 @@
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.