[libvirt] [PATCH 4/5] Ephemeral flag modification within the qemu driver.

Shradha Shah sshah at solarflare.com
Tue Sep 18 15:03:28 UTC 2012


When a guest with ephemeral device is migrated the PCI-
passthrough of the ephemeral device should take place
after migration and hence we check for the vmop in
qemuBuildCommandLine.
---
 src/qemu/qemu_command.c |   48 ++++++++++++++++++++++++----------------------
 1 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b7fbe75..e585ab1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5343,34 +5343,36 @@ qemuBuildCommandLine(virConnectPtr conn,
                     /* For a network with <forward mode='hostdev'>, there is a need to
                      * add the newly minted hostdev to the hostdevs array.
                      */
-                    if (qemuAssignDeviceHostdevAlias(def, hostdev,
-                                                     (def->nhostdevs-1)) < 0) {
-                        goto error;
-                    }
-
-                    if (virDomainHostdevFind(def, hostdev, &found) < 0) {
-                        if (virDomainHostdevInsert(def, hostdev) < 0) {
-                            virReportOOMError();
+                    if (vmop == VIR_NETDEV_VPORT_PROFILE_OP_CREATE) {
+                        if (qemuAssignDeviceHostdevAlias(def, hostdev,
+                                                         (def->nhostdevs-1)) < 0) {
                             goto error;
                         }
-                        if (qemuPrepareHostdevPCIDevices(driver, def->name, def->uuid,
-                                                         &hostdev, 1) < 0) {
+
+                        if (virDomainHostdevFind(def, hostdev, &found) < 0) {
+                            if (virDomainHostdevInsert(def, hostdev) < 0) {
+                                virReportOOMError();
+                                goto error;
+                            }
+                            if (qemuPrepareHostdevPCIDevices(driver, def->name, def->uuid,
+                                                             &hostdev, 1) < 0) {
+                                goto error;
+                            }
+                        }
+                        else {
+                            virReportError(VIR_ERR_INTERNAL_ERROR,
+                                           _("PCI device %04x:%02x:%02x.%x "
+                                             "allocated from network %s is already "
+                                             "in use by domain %s"),
+                                           hostdev->source.subsys.u.pci.domain,
+                                           hostdev->source.subsys.u.pci.bus,
+                                           hostdev->source.subsys.u.pci.slot,
+                                           hostdev->source.subsys.u.pci.function,
+                                           net->data.network.name,
+                                           def->name);
                             goto error;
                         }
                     }
-                    else {
-                        virReportError(VIR_ERR_INTERNAL_ERROR,
-                                       _("PCI device %04x:%02x:%02x.%x "
-                                         "allocated from network %s is already "
-                                         "in use by domain %s"),
-                                       hostdev->source.subsys.u.pci.domain,
-                                       hostdev->source.subsys.u.pci.bus,
-                                       hostdev->source.subsys.u.pci.slot,
-                                       hostdev->source.subsys.u.pci.function,
-                                       net->data.network.name,
-                                       def->name);
-                        goto error;
-                    }
                 }
                 continue;
             }
-- 
1.7.4.4





More information about the libvir-list mailing list