[virt-tools-list] [PATCH 1/2] virtinst: add default USB controller if it's missing
Marc-André Lureau
marcandre.lureau at gmail.com
Fri Sep 23 15:13:56 UTC 2011
---
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
More information about the virt-tools-list
mailing list