details: Handle qemu-xhci as USB3

And fix it in addhardware too
This commit is contained in:
Cole Robinson 2018-10-04 09:53:36 -04:00
parent 35dd99f172
commit b807cfa744
3 changed files with 17 additions and 7 deletions

View File

@ -683,7 +683,7 @@ class vmmAddHardware(vmmGObjectUI):
rows = []
if controller_type == DeviceController.TYPE_USB:
rows.append(["nec-xhci", "USB 3"])
rows.append(["usb3", "USB 3"])
rows.append(["ich9-ehci1", "USB 2"])
elif controller_type == DeviceController.TYPE_SCSI:
rows.append(["virtio-scsi", "VirtIO SCSI"])
@ -1409,8 +1409,13 @@ class vmmAddHardware(vmmGObjectUI):
self.widget("controller-type"))
model = uiutil.get_list_selection(self.widget("controller-model"))
self._dev = DeviceController(self.conn.get_backend())
self._selected_model = model
if model == "usb3":
self._dev = DeviceController.get_usb3_controller(
self.conn.get_backend(), self.vm.xmlobj)
model = None
else:
self._dev = DeviceController(self.conn.get_backend())
controllers = self.vm.xmlobj.devices.controller
controller_num = [x for x in controllers if
@ -1421,9 +1426,7 @@ class vmmAddHardware(vmmGObjectUI):
self._dev.type = controller_type
if model != "none":
if model == "default":
model = None
if model and model != "none":
self._dev.model = model
def _validate_page_rng(self):

View File

@ -2999,8 +2999,11 @@ class vmmDetails(vmmGObjectUI):
if controller.type == "pci":
show_model = False
uiutil.set_grid_row_visible(combo, show_model)
uiutil.set_list_selection(self.widget("controller-model"),
controller.model or None)
model = controller.model
if controller.type == "usb" and "xhci" in str(model):
model = "usb3"
uiutil.set_list_selection(self.widget("controller-model"), model)
def refresh_filesystem_page(self, dev):
self.fsDetails.set_dev(dev)

View File

@ -926,6 +926,10 @@ class vmmDomain(vmmLibvirtObject):
for dev in DeviceController.get_usb2_controllers(
xmlobj.conn):
xmlobj.add_device(dev)
elif model == "usb3":
dev = DeviceController.get_usb3_controller(
xmlobj.conn, xmlobj)
xmlobj.add_device(dev)
else:
dev = DeviceController(xmlobj.conn)
dev.type = "usb"