summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2011-06-06 21:57:06 +0000
committerlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2011-06-06 21:57:06 +0000
commita899c0349e3819508d8492de42f907a8cb7ebdae (patch)
tree6fdac90c8b9ed5c86daa3bf99385af9d8e0c5962
parent1d5052630e6dd2bafc03827067f60ceedab9f439 (diff)
KVM test: usb stick disk support
This patch adds support for virtual usb sticks. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> git-svn-id: svn://test.kernel.org/autotest/trunk@5416 592f7852-d20e-0410-864c-8624ca9c26a4
-rw-r--r--client/virt/kvm_vm.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 087db9b5..3fa4b1a8 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -223,6 +223,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'" % filename
if index is not None:
cmd += ",index=%s" % index
@@ -424,6 +430,9 @@ class VM(virt_vm.BaseVM):
if image_params.get("drive_format") == "ahci" and not have_ahci:
qemu_cmd += " -device ahci,id=ahci"
have_ahci = True
+ if image_params.get("drive_format") == "usb2" and not have_usb2:
+ qemu_cmd += " -device usb-ehci,id=ehci"
+ have_usb2 = True
qemu_cmd += add_drive(help,
virt_vm.get_image_filename(image_params, root_dir),
image_params.get("drive_index"),