[PATCH 3/3] qemu: Emit an event on lease attach/detach

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

 



Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1639228

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c  | 9 ++++++++-
 src/qemu/qemu_hotplug.c | 9 +++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 83674169c2..41940e9007 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7852,8 +7852,15 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
     case VIR_DOMAIN_DEVICE_LEASE:
         ret = qemuDomainAttachLease(driver, vm,
                                     dev->data.lease);
-        if (ret == 0)
+        if (ret == 0) {
+            event = virDomainEventLeaseChangeNewFromObj(vm,
+                                                        VIR_CONNECT_DOMAIN_EVENT_LEASE_ACTION_ATTACH,
+                                                        dev->data.lease->lockspace,
+                                                        dev->data.lease->key,
+                                                        dev->data.lease->path,
+                                                        dev->data.lease->offset);
             dev->data.lease = NULL;
+        }
         break;
 
     case VIR_DOMAIN_DEVICE_NET:
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 5608566d69..5f8476098c 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -5724,6 +5724,7 @@ qemuDomainDetachDeviceLease(virQEMUDriverPtr driver,
                             virDomainLeaseDefPtr lease)
 {
     virDomainLeaseDefPtr det_lease;
+    virObjectEventPtr event = NULL;
     int idx;
 
     if ((idx = virDomainLeaseIndex(vm->def, lease)) < 0) {
@@ -5736,6 +5737,14 @@ qemuDomainDetachDeviceLease(virQEMUDriverPtr driver,
     if (virDomainLockLeaseDetach(driver->lockManager, vm, lease) < 0)
         return -1;
 
+    event = virDomainEventLeaseChangeNewFromObj(vm,
+                                                VIR_CONNECT_DOMAIN_EVENT_LEASE_ACTION_DETACH,
+                                                lease->lockspace,
+                                                lease->key,
+                                                lease->path,
+                                                lease->offset);
+    virObjectEventStateQueue(driver->domainEventState, event);
+
     det_lease = virDomainLeaseRemoveAt(vm->def, idx);
     virDomainLeaseDefFree(det_lease);
     return 0;
-- 
2.26.2




[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