usb-storage connected via uhci / xhci.

Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 client/virt/kvm_vm.py |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 2aabc7c..26d6b77 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -407,8 +407,8 @@ 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
+                if format in ['usb1', 'usb2', 'usb3']:
+                    name = "%s.%s" % (format, index)
                     dev += " -device usb-storage"
                     dev += _add_option("bus", bus)
                     dev += _add_option("port", port)
@@ -460,8 +460,8 @@ class VM(virt_vm.BaseVM):
                 dev += _add_option("drive", name)
                 format = "none"
                 index = None
-            if format == "usb2":
-                name = "usb2.%s" % index
+            if format in ['usb1', 'usb2', 'usb3']:
+                name = "%s.%s" % (format, index)
                 dev += " -device usb-storage"
                 dev += _add_option("bus", bus)
                 dev += _add_option("port", port)
@@ -970,8 +970,12 @@ class VM(virt_vm.BaseVM):
 
             bus = None
             port = None
+            if image_params.get("drive_format") == "usb1":
+                bus, port = get_free_usb_port(image_name, "uhci")
             if image_params.get("drive_format") == "usb2":
                 bus, port = get_free_usb_port(image_name, "ehci")
+            if image_params.get("drive_format") == "usb3":
+                bus, port = get_free_usb_port(image_name, "xhci")
             if image_params.get("drive_format").startswith("scsi-"):
                 try:
                     bus = int(image_params.get("drive_bus", 0))
@@ -1097,8 +1101,12 @@ class VM(virt_vm.BaseVM):
             iso = cdrom_params.get("cdrom")
             bus = None
             port = None
+            if cd_format == "usb1":
+                bus, port = get_free_usb_port(image_name, "uhci")
             if cd_format == "usb2":
                 bus, port = get_free_usb_port(image_name, "ehci")
+            if cd_format == "usb3":
+                bus, port = get_free_usb_port(image_name, "xhci")
             if cd_format == "ahci" and not have_ahci:
                 qemu_cmd += " -device ahci,id=ahci"
                 have_ahci = True
-- 
1.7.1

_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to