fixes missing bus and port for usb2 cdroms.
Signed-off-by: Lukáš Doktor <[email protected]>
---
client/virt/guest-hw.cfg.sample | 2 ++
client/virt/kvm_vm.py | 12 +++++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/client/virt/guest-hw.cfg.sample b/client/virt/guest-hw.cfg.sample
index 655ac9b..d6a5ae2 100644
--- a/client/virt/guest-hw.cfg.sample
+++ b/client/virt/guest-hw.cfg.sample
@@ -75,6 +75,8 @@ variants:
usb_type_default-ehci = usb-ehci
- usb_cdrom:
cd_format=usb2
+ usbs += " default-ehci-cd"
+ usb_type_default-ehci-cd = usb-ehci
- xenblk:
# placeholder
diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 6bc1ae6..fcd3233 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -272,7 +272,8 @@ class VM(virt_vm.BaseVM):
def add_smp(help, smp):
return " -smp %s" % smp
- def add_cdrom(help, filename, index=None, format=None, bus=None):
+ def add_cdrom(help, filename, index=None, format=None, bus=None,
+ port=None):
if has_option(help, "drive"):
name = None;
dev = "";
@@ -283,8 +284,10 @@ class VM(virt_vm.BaseVM):
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)
+ dev += " -device usb-storage"
+ dev += _add_option("bus", bus)
+ dev += _add_option("port", port)
+ dev += _add_option("drive", name)
format = "none"
index = None
if format is not None and format.startswith("scsi-"):
@@ -855,6 +858,9 @@ class VM(virt_vm.BaseVM):
cdrom_params = params.object_params(cdrom)
iso = cdrom_params.get("cdrom")
bus = None
+ port = None
+ if cd_format == "usb2":
+ bus, port = get_free_usb_port(image_name, "ehci")
if cd_format == "ahci" and not have_ahci:
qemu_cmd += " -device ahci,id=ahci"
have_ahci = True
--
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html