diff options
author | lmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4> | 2011-06-06 21:56:15 +0000 |
---|---|---|
committer | lmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4> | 2011-06-06 21:56:15 +0000 |
commit | 1d5052630e6dd2bafc03827067f60ceedab9f439 (patch) | |
tree | 0ea2f03e4f049636ffa67a8c0f1fdea224a4d6a5 | |
parent | 4e939fd6eb7ec2ceacd286f90aa5c272e4c600d9 (diff) |
KVM test: usb cdrom support
This patch adds support for virtual usb cdrom drives.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@5415 592f7852-d20e-0410-864c-8624ca9c26a4
-rw-r--r-- | client/virt/kvm_vm.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py index f6a77fcb..087db9b5 100644 --- a/client/virt/kvm_vm.py +++ b/client/virt/kvm_vm.py @@ -197,6 +197,12 @@ class VM(virt_vm.BaseVM): dev += " -device ide-drive,bus=ahci.%s,drive=%s" % (index, name) format = "none" index = None + if format == "usb2": + name = "usb2.%s" % index + dev += " -device usb-storage,bus=ehci.0,drive=%s" % name + dev += ",port=%d" % (int(index) + 1) + format = "none" + index = None cmd = " -drive file='%s',media=cdrom" % filename if index is not None: cmd += ",index=%s" % index @@ -374,6 +380,7 @@ class VM(virt_vm.BaseVM): root_dir = self.root_dir have_ahci = False + have_usb2 = False # Clone this VM using the new params vm = self.clone(name, params, root_dir, copy_state=True) @@ -484,6 +491,9 @@ class VM(virt_vm.BaseVM): if cdrom_params.get("cd_format") == "ahci" and not have_ahci: qemu_cmd += " -device ahci,id=ahci" have_ahci = True + if cdrom_params.get("cd_format") == "usb2" and not have_usb2: + qemu_cmd += " -device usb-ehci,id=ehci" + have_usb2 = True if iso: qemu_cmd += add_cdrom(help, virt_utils.get_path(root_dir, iso), cdrom_params.get("drive_index"), |