Remember whether the user passed an explicit index when registering the event so that we can avoid the top level event when it isn't needed. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 4 ++++ src/qemu/qemu_process.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 235f575901..eeca5074ce 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19604,6 +19604,10 @@ qemuDomainSetBlockThreshold(virDomainPtr dom, if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) goto endjob; + /* we need to remember whether the threshold was registered with an explicit + * index to fire the correct event */ + src->thresholdEventWithIndex = !!strchr(dev, '['); + ret = 0; endjob: diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 2b03b0ab98..f8916282bf 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1487,7 +1487,8 @@ qemuProcessHandleBlockThreshold(qemuMonitor *mon G_GNUC_UNUSED, if (virStorageSourceIsLocalStorage(src)) path = src->path; - if (src == disk->src) { + if (src == disk->src && + !src->thresholdEventWithIndex) { g_autofree char *dev = qemuDomainDiskBackingStoreGetName(disk, 0); eventDevice = virDomainEventBlockThresholdNewFromObj(vm, dev, path, -- 2.31.1