1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-26 03:21:44 +03:00

qemu: blockjob: Make sure that internal states are not reported as event

While the callers should make sure that they don't call
qemuBlockJobEmitEvents for any internal state or job, let's add checks
that prevents us from emitting wrong events altogether.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Peter Krempa 2019-01-24 09:49:26 +01:00
parent 3355edd6f0
commit 8d5df64449

View File

@ -214,6 +214,11 @@ qemuBlockJobEmitEvents(virQEMUDriverPtr driver,
virObjectEventPtr event = NULL;
virObjectEventPtr event2 = NULL;
/* don't emit events for internal jobs and states */
if (type >= VIR_DOMAIN_BLOCK_JOB_TYPE_LAST ||
status >= VIR_DOMAIN_BLOCK_JOB_LAST)
return;
if (virStorageSourceIsLocalStorage(disk->src) &&
!virStorageSourceIsEmpty(disk->src)) {
event = virDomainEventBlockJobNewFromObj(vm, virDomainDiskGetSource(disk),