]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Re-reserve all PCI addresses on libvirtd restart
authorJiri Denemark <jdenemar@redhat.com>
Fri, 13 Aug 2010 14:16:19 +0000 (16:16 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 16 Aug 2010 19:36:53 +0000 (21:36 +0200)
When reconnecting to existing VMs, we re-reserved only those PCI
addresses which were explicitly mentioned in domain XML. Since some
addresses are always reserved (e.g., 0:0:0 and 0:0:1), we need to handle
those too.

Also all this should only be done if device flag is supported by qemu.

src/qemu/qemu_driver.c

index cb420986ba8a8dae9591dfa06bbf86bebdf86bd9..45e84fc804008c2b112e392cac6daa15d5791055 100644 (file)
@@ -1464,11 +1464,13 @@ qemuReconnectDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaq
     if (qemudExtractVersionInfo(obj->def->emulator,
                                 NULL,
                                 &qemuCmdFlags) >= 0 &&
-        (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE))
+        (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE)) {
         priv->persistentAddrs = 1;
 
-    if (!(priv->pciaddrs = qemuDomainPCIAddressSetCreate(obj->def)))
-        goto error;
+        if (!(priv->pciaddrs = qemuDomainPCIAddressSetCreate(obj->def)) ||
+            qemuAssignDevicePCISlots(obj->def, priv->pciaddrs) < 0)
+            goto error;
+    }
 
     if (driver->securityDriver &&
         driver->securityDriver->domainReserveSecurityLabel &&