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(a)redhat.com>
---
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