Only for devices that have an alias. --- src/qemu/qemu_driver.c | 17 ++++++++++++++++- src/qemu/qemu_hotplug.c | 5 +++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6132674..c13f22b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7586,17 +7586,20 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, { virQEMUDriverPtr driver = dom->conn->privateData; int ret = -1; + const char *alias = NULL; switch ((virDomainDeviceType) dev->type) { case VIR_DOMAIN_DEVICE_DISK: qemuDomainObjCheckDiskTaint(driver, vm, dev->data.disk, -1); ret = qemuDomainAttachDeviceDiskLive(dom->conn, driver, vm, dev); + alias = dev->data.disk->info.alias; if (!ret) dev->data.disk = NULL; break; case VIR_DOMAIN_DEVICE_CONTROLLER: ret = qemuDomainAttachDeviceControllerLive(driver, vm, dev); + alias = dev->data.controller->info.alias; if (!ret) dev->data.controller = NULL; break; @@ -7612,6 +7615,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, qemuDomainObjCheckNetTaint(driver, vm, dev->data.net, -1); ret = qemuDomainAttachNetDevice(dom->conn, driver, vm, dev->data.net); + alias = dev->data.net->info.alias; if (!ret) dev->data.net = NULL; break; @@ -7620,6 +7624,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, qemuDomainObjCheckHostdevTaint(driver, vm, dev->data.hostdev, -1); ret = qemuDomainAttachHostDevice(dom->conn, driver, vm, dev->data.hostdev); + alias = dev->data.hostdev->info->alias; if (!ret) dev->data.hostdev = NULL; break; @@ -7627,6 +7632,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, case VIR_DOMAIN_DEVICE_REDIRDEV: ret = qemuDomainAttachRedirdevDevice(driver, vm, dev->data.redirdev); + alias = dev->data.redirdev->info.alias; if (!ret) dev->data.redirdev = NULL; break; @@ -7634,6 +7640,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, case VIR_DOMAIN_DEVICE_CHR: ret = qemuDomainAttachChrDevice(driver, vm, dev->data.chr); + alias = dev->data.chr->info.alias; if (!ret) dev->data.chr = NULL; break; @@ -7641,6 +7648,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, case VIR_DOMAIN_DEVICE_RNG: ret = qemuDomainAttachRNGDevice(driver, vm, dev->data.rng); + alias = dev->data.rng->info.alias; if (!ret) dev->data.rng = NULL; break; @@ -7673,8 +7681,15 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm, break; } - if (ret == 0) + if (ret == 0) { ret = qemuDomainUpdateDeviceList(driver, vm, QEMU_ASYNC_JOB_NONE); + if (alias) { + virObjectEventPtr event; + event = virDomainEventDeviceAddedNewFromObj(vm, alias); + if (event) + qemuDomainEventQueue(driver, event); + } + } return ret; } diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 2f0549e..f07c54d 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1726,6 +1726,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, char *objalias = NULL; const char *backendType; virJSONValuePtr props = NULL; + virObjectEventPtr event; int id; int ret = -1; @@ -1769,6 +1770,10 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver, goto cleanup; } + event = virDomainEventDeviceAddedNewFromObj(vm, objalias); + if (event) + qemuDomainEventQueue(driver, event); + /* mem is consumed by vm->def */ mem = NULL; -- 2.0.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list