[libvirt] [PATCH 09/14] Make qemuCmdFlags available in qemudDomainAttachDevice()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



qemudDomainChangeEjectableMedia() currently extracts the qemu command
line flags, but other device attaching code might need it, so move
the qemudExtractVersionInfo() call up a frame.

* src/qemu_driver.c: move the qemudExtractVersionInfo() call from
  qemudDomainChangeEjectableMedia() to qemudDomainAttachDevice()
---
 src/qemu_driver.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 3dec630..cbc185c 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -4239,12 +4239,12 @@ static char *qemudDiskDeviceName(const virConnectPtr conn,
 
 static int qemudDomainChangeEjectableMedia(virConnectPtr conn,
                                            virDomainObjPtr vm,
-                                           virDomainDeviceDefPtr dev)
+                                           virDomainDeviceDefPtr dev,
+                                           unsigned int qemuCmdFlags)
 {
     virDomainDiskDefPtr origdisk = NULL, newdisk;
     char *cmd, *reply, *safe_path;
     char *devname = NULL;
-    unsigned int qemuCmdFlags;
     int i;
 
     origdisk = NULL;
@@ -4265,11 +4265,6 @@ static int qemudDomainChangeEjectableMedia(virConnectPtr conn,
         return -1;
     }
 
-    if (qemudExtractVersionInfo(vm->def->emulator,
-                                NULL,
-                                &qemuCmdFlags) < 0)
-        return -1;
-
     if (qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE) {
         if (!(devname = qemudDiskDeviceName(conn, newdisk)))
             return -1;
@@ -4554,6 +4549,7 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
     struct qemud_driver *driver = dom->conn->privateData;
     virDomainObjPtr vm;
     virDomainDeviceDefPtr dev = NULL;
+    unsigned int qemuCmdFlags;
     int ret = -1;
 
     qemuDriverLock(driver);
@@ -4577,6 +4573,10 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
     if (dev == NULL)
         goto cleanup;
 
+    if (qemudExtractVersionInfo(vm->def->emulator,
+                                NULL,
+                                &qemuCmdFlags) < 0)
+        goto cleanup;
 
     if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
         switch (dev->data.disk->device) {
@@ -4588,7 +4588,7 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
             if (qemuDomainSetDeviceOwnership(dom->conn, driver, dev, 0) < 0)
                 goto cleanup;
 
-            ret = qemudDomainChangeEjectableMedia(dom->conn, vm, dev);
+            ret = qemudDomainChangeEjectableMedia(dom->conn, vm, dev, qemuCmdFlags);
             break;
 
         case VIR_DOMAIN_DISK_DEVICE_DISK:
-- 
1.6.2.5

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]