From b618a45b0f721fa5153b138569248bfb661d4c74 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 17 Jan 2019 13:52:09 +0100 Subject: [PATCH] qemu: blockjob: Emit VIR_DOMAIN_EVENT_ID_BLOCK_JOB only for local disks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- src/qemu/qemu_blockjob.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 4b016f1ee9..828140138d 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,9 +58,12 @@ qemuBlockJobEmitEvents(virQEMUDriverPtr driver, virObjectEventPtr event = NULL; virObjectEventPtr event2 = NULL; - event = virDomainEventBlockJobNewFromObj(vm, virDomainDiskGetSource(disk), - type, status); - virObjectEventStateQueue(driver->domainEventState, event); + if (virStorageSourceIsLocalStorage(disk->src) && + !virStorageSourceIsEmpty(disk->src)) { + event = virDomainEventBlockJobNewFromObj(vm, virDomainDiskGetSource(disk), + type, status); + virObjectEventStateQueue(driver->domainEventState, event); + } event2 = virDomainEventBlockJob2NewFromObj(vm, disk->dst, type, status); virObjectEventStateQueue(driver->domainEventState, event2); -- GitLab