[PATCH 15/21] qemu_hotplug: pull qemuDomainUpdateDeviceList out of qemuDomainDetachDeviceLive

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

 



qemuDomainDetachDeviceLive() is called from two places in
qemu_driver.c. Move the call to qemuDomainUpdateDeviceList() from the
end of that function, which is now in qemu_hotplug.c, to the two
places that call qemuDomainDetachDeviceLive().

Removing that one call from qemuDomainDetachDeviceList() will permit
us to call it from the test driver, replacing the separate calls to
qemuDomainDetachDeviceDiskLive(), qemuDomainDetachChrDevice(),
qemuDomainDetachShmemDevice() and qemuDomainDetachWatchdog(). We want
to do this so that part of the common functionality of those three
functions (and the rest of the device-specific Detach functions) can
be pulled up into qemuDomainDetachDeviceLive() without breaking the
test. (This is done in the next patch).

Signed-off-by: Laine Stump <laine@xxxxxxxxx>
---
 src/qemu/qemu_driver.c  | 7 +++++++
 src/qemu/qemu_hotplug.c | 3 ---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0b80004c6e..8e7bb913a2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8932,6 +8932,10 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr driver,
     if (flags & VIR_DOMAIN_AFFECT_LIVE) {
         if (qemuDomainDetachDeviceLive(vm, dev_copy, driver, false) < 0)
             goto cleanup;
+
+        if (qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)
+            goto cleanup;
+
         /*
          * update domain status forcibly because the domain status may be
          * changed even if we failed to attach the device. For example,
@@ -9014,6 +9018,9 @@ qemuDomainDetachDeviceAliasLiveAndConfig(virQEMUDriverPtr driver,
 
         if (qemuDomainDetachDeviceLive(vm, &dev, driver, true) < 0)
             goto cleanup;
+
+        if (qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)
+            goto cleanup;
     }
 
     if (vmdef) {
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 6b713e1c27..ea5b6bf8ac 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -6271,9 +6271,6 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm,
         break;
     }
 
-    if (ret == 0)
-        ret = qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE);
-
     return ret;
 }
 
-- 
2.20.1

--
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]

  Powered by Linux