[v2 4/4] RFC: Default to ICH9 USB2 controller for Win7

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

 



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 dfb5ed2..9d26192 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
@@ -1439,6 +1440,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")
@@ -1462,6 +1464,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 e59f7a4..3d6729f 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"],
@@ -575,6 +577,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 1fb3e28..36ba663 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]