[PATCH RFC 02/51] qemu: blockjob: Emit VIR_DOMAIN_EVENT_ID_BLOCK_JOB only for local disks

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

 



The event reports the disk path to identify the disk which makes sense
only for local disks. Additionally network backed disks like NBD don't
need to have a path so the callback would return NULL.

Report VIR_DOMAIN_EVENT_ID_BLOCK_JOB only for non-empty local disks.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_blockjob.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index ea327b83fe..d38674a9d0 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -46,7 +46,7 @@ VIR_LOG_INIT("qemu.qemu_blockjob");
  * qemuBlockJobEmitEvents:
  *
  * Emits the VIR_DOMAIN_EVENT_ID_BLOCK_JOB and VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2
- * for a block job.
+ * for a block job. The former event is emitted only for local disks.
  */
 static void
 qemuBlockJobEmitEvents(virQEMUDriverPtr driver,
@@ -58,8 +58,11 @@ qemuBlockJobEmitEvents(virQEMUDriverPtr driver,
     virObjectEventPtr event = NULL;
     virObjectEventPtr event2 = NULL;

-    event = virDomainEventBlockJobNewFromObj(vm, disk->src->path, type, status);
-    virObjectEventStateQueue(driver->domainEventState, event);
+    if (virStorageSourceIsLocalStorage(disk->src) &&
+        !virStorageSourceIsEmpty(disk->src)) {
+        event = virDomainEventBlockJobNewFromObj(vm, disk->src->path, type, status);
+        virObjectEventStateQueue(driver->domainEventState, event);
+    }

     event2 = virDomainEventBlockJob2NewFromObj(vm, disk->dst, type, status);
     virObjectEventStateQueue(driver->domainEventState, event2);
-- 
2.19.2

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