]> xenbits.xensource.com Git - people/dariof/libvirt.git/commitdiff
conf: add default USB controller in qemu post-parse callback
authorLaine Stump <laine@laine.org>
Fri, 2 Aug 2013 08:13:33 +0000 (04:13 -0400)
committerLaine Stump <laine@laine.org>
Sat, 3 Aug 2013 19:37:41 +0000 (15:37 -0400)
The parser shouldn't be doing arch-specific things like adding in
implicit controllers to the config. This should instead be done in the
hypervisor's post-parse callback.

This patch removes the auto-add of a usb controller from the domain
parser, and puts it into the qemu driver's post-parse callback (just
as is already done with the auto-add of the pci-root controller). In
the future, any machine/arch that shouldn't have a default usb
controller added should just set addDefaultUSB = false in this
function.

We've recently seen that q35 and ARMV7L domains shouldn't get a default USB
controller, so I've set addDefaultUSB to false for both of those.

src/conf/domain_conf.c
src/qemu/qemu_domain.c

index e3aec69b74931e0b353d0a1c4c6b56a035e831e9..63350b6eb0df37857fc5a89b4dbf3ffd5be6ca4b 100644 (file)
@@ -11718,12 +11718,6 @@ virDomainDefParseXML(xmlDocPtr xml,
         goto error;
     }
 
-    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)
-            goto error;
-
     /* analysis of the resource leases */
     if ((n = virXPathNodeSet("./devices/lease", ctxt, &nodes)) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
index 1ff802ce598db674445c266291d1100e1cfb8380..d3da6669b921bbf05855589a9f86548ab859e6f0 100644 (file)
@@ -699,6 +699,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
                        virCapsPtr caps,
                        void *opaque ATTRIBUTE_UNUSED)
 {
+    bool addDefaultUSB = true;
     bool addPCIRoot = false;
 
     /* check for emulator and create a default one if needed */
@@ -714,8 +715,10 @@ qemuDomainDefPostParse(virDomainDefPtr def,
             break;
         if (STRPREFIX(def->os.machine, "pc-q35") ||
             STREQ(def->os.machine, "q35") ||
-            STREQ(def->os.machine, "isapc"))
+            STREQ(def->os.machine, "isapc")) {
+            addDefaultUSB = false;
             break;
+        }
         if (!STRPREFIX(def->os.machine, "pc-0.") &&
             !STRPREFIX(def->os.machine, "pc-1.") &&
             !STRPREFIX(def->os.machine, "pc-i440") &&
@@ -725,6 +728,10 @@ qemuDomainDefPostParse(virDomainDefPtr def,
         addPCIRoot = true;
         break;
 
+    case VIR_ARCH_ARMV7L:
+       addDefaultUSB = false;
+       break;
+
     case VIR_ARCH_ALPHA:
     case VIR_ARCH_PPC:
     case VIR_ARCH_PPC64:
@@ -737,6 +744,11 @@ qemuDomainDefPostParse(virDomainDefPtr def,
         break;
     }
 
+    if (addDefaultUSB &&
+        virDomainDefMaybeAddController(
+            def, VIR_DOMAIN_CONTROLLER_TYPE_USB, 0, -1) < 0)
+        return -1;
+
     if (addPCIRoot &&
         virDomainDefMaybeAddController(
             def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0,