[virt-tools-list] [PATCH 4/4] RFC: Default to ICH9 USB2 controller for Win7
Marc-André Lureau
marcandre.lureau at gmail.com
Fri Sep 2 01:21:19 UTC 2011
We may want to add more guests, though I don't know exactly which
version supports it. So this patch is a proof-of-concept/idea.
---
virtinst/Guest.py | 26 ++++++++++++++++++++++++++
virtinst/osdict.py | 3 +++
virtinst/support.py | 6 ++++++
3 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/virtinst/Guest.py b/virtinst/Guest.py
index 3dd04d1..f8e0674 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
@@ -1440,6 +1441,7 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
inputtype = VirtualDevice.VIRTUAL_DEV_INPUT
gfxtype = VirtualDevice.VIRTUAL_DEV_GRAPHICS
channeltype = VirtualDevice.VIRTUAL_DEV_CHANNEL
+ ctrltype = VirtualDevice.VIRTUAL_DEV_CONTROLLER
# Set default input values
input_type = self._lookup_device_param(inputtype, "type")
@@ -1463,6 +1465,30 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
disk.bus = "xen"
used_targets.append(disk.generate_target(used_targets))
+ def has_usb_ctrl():
+ for ctrl in devlist_func(ctrltype):
+ if ctrl.type == ctrl.CONTROLLER_TYPE_USB:
+ return True
+
+ if (not has_usb_ctrl() and
+ self._lookup_osdict_key("usb") == "ich9"):
+ ctrl = VirtualControllerUSB(self.conn,
+ model="ich9-ehci1")
+ self.add_device(ctrl)
+ ctrl = VirtualControllerUSB(self.conn,
+ model="ich9-uhci1")
+ ctrl.get_master().startport = 0
+ self.add_device(ctrl)
+ ctrl = VirtualControllerUSB(self.conn,
+ model="ich9-uhci2")
+ ctrl.get_master().startport = 2
+ self.add_device(ctrl)
+ ctrl = VirtualControllerUSB(self.conn,
+ model="ich9-uhci3")
+ ctrl.get_master().startport = 4
+ self.add_device(ctrl)
+
+
# Set sound device model
sound_model = self._lookup_device_param(soundtype, "model")
for sound in devlist_func(soundtype):
diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index 38c8901..a56f114 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -35,6 +35,7 @@ DISK = VirtualDevice.VIRTUAL_DEV_DISK
INPUT = VirtualDevice.VIRTUAL_DEV_INPUT
SOUND = VirtualDevice.VIRTUAL_DEV_AUDIO
VIDEO = VirtualDevice.VIRTUAL_DEV_VIDEO
+CONTROLLER = VirtualDevice.VIRTUAL_DEV_CONTROLLER
VIRTIO_DISK = {
"bus" : [
@@ -72,6 +73,7 @@ DEFAULTS = {
"label": None,
"pv_cdrom_install": False,
"supported": False,
+ "usb": [(HV_ALL, "default")],
"devices" : {
# "devname" : { "attribute" : [( ["applicable", "hv-type", list"],
@@ -586,6 +588,7 @@ OS_TYPES = {
"supported": True,
"sortby": "mswin7",
"distro": "win",
+ "usb": [(support.SUPPORT_CONN_HV_CTRL_USB_ICH9, "ich9")]
},
},
diff --git a/virtinst/support.py b/virtinst/support.py
index b1db501..0d63401 100644
--- a/virtinst/support.py
+++ b/virtinst/support.py
@@ -65,6 +65,7 @@ SUPPORT_CONN_HV_GRAPHICS_SPICE = 5004
SUPPORT_CONN_HV_CHAR_SPICEVMC = 5005
SUPPORT_CONN_HV_DIRECT_INTERFACE = 5006
SUPPORT_CONN_HV_FILESYSTEM = 5007
+SUPPORT_CONN_HV_CTRL_USB_ICH9 = 5008
# Flags for check_stream_support
SUPPORT_STREAM_UPLOAD = 6000
@@ -265,6 +266,11 @@ _support_dict = {
("openvz", 0),
("test", 0)],
},
+ SUPPORT_CONN_HV_CTRL_USB_ICH9 : {
+ "version" : 9005,
+ "force_version" : True,
+ "drv_version" : [ ("qemu", 15000), ],
+ },
SUPPORT_STREAM_UPLOAD : {
--
1.7.6
More information about the virt-tools-list
mailing list