diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h
index 389c7b56d1..40db29c418 100644
--- a/src/conf/storage_source_conf.h
+++ b/src/conf/storage_source_conf.h
@@ -387,6 +387,11 @@ struct _virStorageSource {
char *nfs_group;
uid_t nfs_uid;
gid_t nfs_gid;
+
+ /* We need a flag to remember that the threshold event for this source was
+ * registered with a full index (vda[3]) so that we can properly report just
+ * one event for it */
+ bool thresholdEventWithIndex;
};
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virStorageSource, virObjectUnref);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 5fcd5e7f82..89e03fdf72 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1951,6 +1951,7 @@ qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt,
g_autofree char *encalias = NULL;
g_autofree char *httpcookiealias = NULL;
g_autofree char *tlskeyalias = NULL;
+ g_autofree char *thresholdEventWithIndex = NULL;
src->nodestorage = virXPathString("string(./nodenames/nodename[@type='storage']/@name)", ctxt);
src->nodeformat = virXPathString("string(./nodenames/nodename[@type='format']/@name)", ctxt);
@@ -1990,6 +1991,10 @@ qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt,
if (virStorageSourcePrivateDataParseRelPath(ctxt, src) < 0)
return -1;
+ if ((thresholdEventWithIndex = virXPathString("string(./thresholdEvent/@indexUsed)", ctxt)) &&
+ virTristateBoolTypeFromString(thresholdEventWithIndex) == VIR_TRISTATE_BOOL_YES)
+ src->thresholdEventWithIndex = true;
+
return 0;
}
@@ -2044,6 +2049,9 @@ qemuStorageSourcePrivateDataFormat(virStorageSource *src,
virXMLFormatElement(buf, "objects", NULL, &tmp);
+ if (src->thresholdEventWithIndex)
+ virBufferAddLit(buf, "\n");
+
return 0;
}
diff --git a/tests/qemustatusxml2xmldata/modern-in.xml b/tests/qemustatusxml2xmldata/modern-in.xml
index ba0858a4ff..cc5fd1cb74 100644
--- a/tests/qemustatusxml2xmldata/modern-in.xml
+++ b/tests/qemustatusxml2xmldata/modern-in.xml
@@ -340,6 +340,7 @@
+