[PATCH 2/5] qemu: blockjob: Make sure that internal states are not reported as event

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

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_blockjob.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 9b638b7ef6..ba98ef2259 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -214,6 +214,10 @@ qemuBlockJobEmitEvents(virQEMUDriverPtr driver,
     virObjectEventPtr event = NULL;
     virObjectEventPtr event2 = NULL;

+    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),
-- 
2.20.1

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