]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Move device alias assigning before command line construction
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 20 Oct 2011 12:45:12 +0000 (14:45 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 25 Oct 2011 07:27:10 +0000 (09:27 +0200)
This patch is rather cosmetic as it only moves device alias
assignation from command line construction just before that.
However, it is needed in connotation of previous and next patch.

src/qemu/qemu_command.c
src/qemu/qemu_command.h
src/qemu/qemu_driver.c
src/qemu/qemu_process.c
tests/qemuxml2argvtest.c
tests/qemuxmlnstest.c

index 30c0be6509e02818bffd863c9bd78a357f941ebe..0c5bfab8e5d8b5d10e8db120f250bae3edc9e24a 100644 (file)
@@ -656,7 +656,7 @@ qemuAssignDeviceControllerAlias(virDomainControllerDefPtr controller)
 }
 
 
-static int
+int
 qemuAssignDeviceAliases(virDomainDefPtr def, virBitmapPtr qemuCaps)
 {
     int i;
@@ -3284,9 +3284,6 @@ qemuBuildCommandLine(virConnectPtr conn,
     bool usblegacy = false;
     uname_normalize(&ut);
 
-    if (qemuAssignDeviceAliases(def, qemuCaps) < 0)
-        return NULL;
-
     virUUIDFormat(def->uuid, uuid);
 
     emulator = def->emulator;
index 00e58a27b7a55658d2c5bd7311b39a5806c6a0ad..d34df8f23668ef21325e6fa49472c0a5fee025b8 100644 (file)
@@ -187,6 +187,7 @@ int qemuDomainPCIAddressReleaseSlot(qemuDomainPCIAddressSetPtr addrs, int slot);
 void qemuDomainPCIAddressSetFree(qemuDomainPCIAddressSetPtr addrs);
 int  qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs);
 
+int qemuAssignDeviceAliases(virDomainDefPtr def, virBitmapPtr qemuCaps);
 int qemuDomainNetVLAN(virDomainNetDefPtr def);
 int qemuAssignDeviceNetAlias(virDomainDefPtr def, virDomainNetDefPtr net, int idx);
 int qemuAssignDeviceDiskAlias(virDomainDiskDefPtr def, virBitmapPtr qemuCaps);
index 6b65716b29fd59a7ccd5303c7fea24a830ef9e1b..f93b78487391e32cc6972e0d7c8e35b1c433b354 100644 (file)
@@ -4621,6 +4621,9 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
     if (qemuProcessPrepareMonitorChr(driver, &monConfig, def->name) < 0)
         goto cleanup;
 
+    if (qemuAssignDeviceAliases(def, qemuCaps) < 0)
+        goto cleanup;
+
     if (!(cmd = qemuBuildCommandLine(conn, driver, def,
                                      &monConfig, monitor_json, qemuCaps,
                                      NULL, -1, NULL, VIR_VM_OP_NO_OP)))
index a7fe86c82ffc73f7a2ff415868f2c8da782fc1b5..c0f6fd41b87c7d9530f7b82b3af48863ec3c1d4c 100644 (file)
@@ -3015,6 +3015,9 @@ int qemuProcessStart(virConnectPtr conn,
         priv->persistentAddrs = 0;
     }
 
+    if (qemuAssignDeviceAliases(vm->def, priv->qemuCaps) < 0)
+        goto cleanup;
+
     VIR_DEBUG("Building emulator command line");
     if (!(cmd = qemuBuildCommandLine(conn, driver, vm->def, priv->monConfig,
                                      priv->monJSON != 0, priv->qemuCaps,
index a7ae925f1f9562d5ada381e4f4520dedaf4874a8..a64f45e69ce8c6486673486d96a0f4a774766277 100644 (file)
@@ -118,6 +118,9 @@ static int testCompareXMLToArgvFiles(const char *xml,
         qemuCapsSet(extraFlags, QEMU_CAPS_PCI_MULTIBUS);
     }
 
+    if (qemuAssignDeviceAliases(vmdef, extraFlags) < 0)
+        goto fail;
+
     if (!(cmd = qemuBuildCommandLine(conn, &driver,
                                      vmdef, &monitor_chr, json, extraFlags,
                                      migrateFrom, migrateFd, NULL,
index 03d5b03a7c7257737c8cde09023078e203bf37ea..b13b409995e4199086a485dfcf8ba4893dbbd8ba 100644 (file)
@@ -118,6 +118,9 @@ static int testCompareXMLToArgvFiles(const char *xml,
         qemuCapsSet(extraFlags, QEMU_CAPS_PCI_MULTIBUS);
     }
 
+    if (qemuAssignDeviceAliases(vmdef, extraFlags) < 0)
+        goto fail;
+
     if (!(cmd = qemuBuildCommandLine(conn, &driver,
                                      vmdef, &monitor_chr, json, extraFlags,
                                      migrateFrom, migrateFd, NULL,