[libvirt] [PATCH 2/9] domain_conf: Set QEMU ARM default USB model to 'none'

Cole Robinson crobinso at redhat.com
Thu Aug 1 02:14:32 UTC 2013


Preferably what we'd do is not add any USB controller by default,
but that goes against how the QEMU driver has historically acted for
other architectures, so let's be consistent.
---
 src/conf/domain_conf.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e3aec69..2308580 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8801,6 +8801,16 @@ virDomainVideoDefaultRAM(virDomainDefPtr def,
     }
 }
 
+static int
+virDomainDefaultUSBControllerModel(virDomainDefPtr def)
+{
+    /* Not entirely true, some ARM boards actually can support USB,
+     * and even versatilepb supports the pci-ohci
+     */
+    if (def->os.arch == VIR_ARCH_ARMV7L)
+        return VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE;
+    return -1;
+}
 
 int
 virDomainVideoDefaultType(virDomainDefPtr def)
@@ -11720,9 +11730,13 @@ virDomainDefParseXML(xmlDocPtr xml,
 
     if (def->virtType == VIR_DOMAIN_VIRT_QEMU ||
         def->virtType == VIR_DOMAIN_VIRT_KQEMU ||
-        def->virtType == VIR_DOMAIN_VIRT_KVM)
-        if (virDomainDefMaybeAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, 0, -1) < 0)
+        def->virtType == VIR_DOMAIN_VIRT_KVM) {
+        if (virDomainDefMaybeAddController(def,
+                                VIR_DOMAIN_CONTROLLER_TYPE_USB,
+                                0,
+                                virDomainDefaultUSBControllerModel(def)) < 0)
             goto error;
+    }
 
     /* analysis of the resource leases */
     if ((n = virXPathNodeSet("./devices/lease", ctxt, &nodes)) < 0) {
-- 
1.8.3.1




More information about the libvir-list mailing list