]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: assign addresses before aliases
authorJán Tomko <jtomko@redhat.com>
Wed, 13 Apr 2016 07:38:29 +0000 (09:38 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 13 Apr 2016 11:07:20 +0000 (13:07 +0200)
The address assigning code might add new pci bridges.
We need them to have an alias when building the command line.

In real word usage, this is not a problem because all the code
paths already call qemuDomainAssignAddresses. However moving
this call lets us remove one extra call from qemuxml2argvtest.

src/qemu/qemu_process.c
tests/qemuxml2argvtest.c

index ca8bb580bf6a94b41df5a5a35ec54b7cb3693a03..f4aa409b89698af2c983fd83c64e965923d81c43 100644 (file)
@@ -4998,6 +4998,19 @@ qemuProcessPrepareDomain(virConnectPtr conn,
         }
     }
 
+    /*
+     * Normally PCI addresses are assigned in the virDomainCreate
+     * or virDomainDefine methods. We might still need to assign
+     * some here to cope with the question of upgrades. Regardless
+     * we also need to populate the PCI address set cache for later
+     * use in hotplug
+     */
+    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+        VIR_DEBUG("Assigning domain PCI addresses");
+        if ((qemuDomainAssignAddresses(vm->def, priv->qemuCaps, vm)) < 0)
+            goto cleanup;
+    }
+
     if (qemuAssignDeviceAliases(vm->def, priv->qemuCaps) < 0)
         goto cleanup;
 
@@ -5021,19 +5034,6 @@ qemuProcessPrepareDomain(virConnectPtr conn,
     priv->monStart = 0;
     priv->gotShutdown = false;
 
-    /*
-     * Normally PCI addresses are assigned in the virDomainCreate
-     * or virDomainDefine methods. We might still need to assign
-     * some here to cope with the question of upgrades. Regardless
-     * we also need to populate the PCI address set cache for later
-     * use in hotplug
-     */
-    if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
-        VIR_DEBUG("Assigning domain PCI addresses");
-        if ((qemuDomainAssignAddresses(vm->def, priv->qemuCaps, vm)) < 0)
-            goto cleanup;
-    }
-
     ret = 0;
  cleanup:
     VIR_FREE(nodeset);
index 2a571761801044a52e75a48830ecfdf83718ca62..be7417820e44a0510f9dddbcbb199cab519b3585 100644 (file)
@@ -311,12 +311,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
 
     virQEMUCapsFilterByMachineType(extraFlags, vm->def->os.machine);
 
-    if (qemuDomainAssignAddresses(vm->def, extraFlags, NULL)) {
-        if (flags & FLAG_EXPECT_FAILURE)
-            goto ok;
-        goto out;
-    }
-
     log = virtTestLogContentAndReset();
     VIR_FREE(log);
     virResetLastError();