[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCH 1/2] virtinst: add default USB controller if it's missing



---
 virtinst/Guest.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/virtinst/Guest.py b/virtinst/Guest.py
index 3dd04d1..a28942c 100644
--- a/virtinst/Guest.py
+++ b/virtinst/Guest.py
@@ -40,6 +40,7 @@ from VirtualDevice import VirtualDevice
 from VirtualDisk import VirtualDisk
 from VirtualInputDevice import VirtualInputDevice
 from VirtualCharDevice import VirtualCharDevice
+from VirtualController import VirtualControllerUSB
 from Clock import Clock
 from Seclabel import Seclabel
 from CPU import CPU
@@ -795,6 +796,17 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
                                    parsexmlnode=devnode, caps=caps)
                 self._add_device(dev)
 
+
+        def has_usb_ctrl():
+            for ctrl in self.get_devices(VirtualDevice.VIRTUAL_DEV_CONTROLLER):
+                if ctrl.type == ctrl.CONTROLLER_TYPE_USB:
+                    return True
+            return False
+
+        if not has_usb_ctrl():
+            ctrl = VirtualControllerUSB(self.conn)
+            self.add_device(ctrl)
+
         self._installer = virtinst.Installer.Installer(self.conn,
                                                    parsexmlnode=self._xml_node,
                                                    caps=caps)
-- 
1.7.6.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]