From: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
Helps calling multiple time per device.
Signed-off-by: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
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