[PATCH v2 13/21] qemu: refactor qemuDomain[Attach|Detach]DeviceLive

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

 



From: Shivaprasad G Bhat <sbhat@xxxxxxxxxxxxxxxxxx>

Helps calling multiple time per device.

Signed-off-by: Shivaprasad G Bhat <sbhat@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/qemu/qemu_driver.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2e91a2b694..fb53dc79df 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7816,9 +7816,9 @@ qemuDomainUndefine(virDomainPtr dom)
 }
 
 static int
-qemuDomainAttachDeviceLive(virDomainObjPtr vm,
-                           virDomainDeviceDefPtr dev,
-                           virQEMUDriverPtr driver)
+qemuDomainAttachDeviceLiveInternal(virDomainObjPtr vm,
+                                   virDomainDeviceDefPtr dev,
+                                   virQEMUDriverPtr driver)
 {
     int ret = -1;
     const char *alias = NULL;
@@ -7964,13 +7964,28 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
         virObjectEventStateQueue(driver->domainEventState, event);
     }
 
+    return ret;
+}
+
+static int
+qemuDomainAttachDeviceLive(virDomainObjPtr vm,
+                           virDomainDeviceDefPtr dev,
+                           virQEMUDriverPtr driver)
+{
+    int ret = -1;
+
+    if (virDomainDefCompatibleDevice(vm->def, dev, NULL,
+                                     VIR_DOMAIN_DEVICE_ACTION_ATTACH,
+                                     false) < 0)
+        return -1;
+
+    ret = qemuDomainAttachDeviceLiveInternal(vm, dev, driver);
     if (ret == 0)
         ret = qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE);
 
     return ret;
 }
 
-
 static int
 qemuDomainChangeDiskLive(virDomainObjPtr vm,
                          virDomainDeviceDefPtr dev,
-- 
2.24.1






[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