summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2011-06-06 21:55:25 +0000
committerlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2011-06-06 21:55:25 +0000
commit4e939fd6eb7ec2ceacd286f90aa5c272e4c600d9 (patch)
tree0092cb933af2432ac6111c63f0e4199e5b1feee0
parentac7028f78b75d4f3d099450a2e7a9ce887b53a4c (diff)
KVM test: ahci cdroms
This patch adds support for AHCI cdroms. SCSI cdroms work too as side effect. The patch also adds cd_format, which is the same as disk_format but for cdroms. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> git-svn-id: svn://test.kernel.org/autotest/trunk@5414 592f7852-d20e-0410-864c-8624ca9c26a4
-rw-r--r--client/virt/kvm_vm.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 43408f6a..f6a77fcb 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -188,11 +188,23 @@ class VM(virt_vm.BaseVM):
def add_smp(help, smp):
return " -smp %s" % smp
- def add_cdrom(help, filename, index=None):
+ def add_cdrom(help, filename, index=None, format=None):
if has_option(help, "drive"):
+ name = None;
+ dev = "";
+ if format == "ahci":
+ name = "ahci%s" % index
+ dev += " -device ide-drive,bus=ahci.%s,drive=%s" % (index, name)
+ format = "none"
+ index = None
cmd = " -drive file='%s',media=cdrom" % filename
- if index is not None: cmd += ",index=%s" % index
- return cmd
+ if index is not None:
+ cmd += ",index=%s" % index
+ if format:
+ cmd += ",if=%s" % format
+ if name:
+ cmd += ",id=%s" % name
+ return cmd + dev
else:
return " -cdrom '%s'" % filename
@@ -469,9 +481,13 @@ class VM(virt_vm.BaseVM):
for cdrom in params.objects("cdroms"):
cdrom_params = params.object_params(cdrom)
iso = cdrom_params.get("cdrom")
+ if cdrom_params.get("cd_format") == "ahci" and not have_ahci:
+ qemu_cmd += " -device ahci,id=ahci"
+ have_ahci = True
if iso:
qemu_cmd += add_cdrom(help, virt_utils.get_path(root_dir, iso),
- cdrom_params.get("drive_index"))
+ cdrom_params.get("drive_index"),
+ cdrom_params.get("cd_format"))
# We may want to add {floppy_otps} parameter for -fda
# {fat:floppy:}/path/. However vvfat is not usually recommended.