Bind it to qemus BLOCK_WRITE_THRESHOLD event. Look up the disk by
nodename and construct the string to return.
---
src/qemu/qemu_process.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ea10fff45..cfe4073de 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1439,6 +1439,45 @@ qemuProcessHandleAcpiOstInfo(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
static int
+qemuProcessHandleBlockThreshold(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
+ virDomainObjPtr vm,
+ const char *nodename,
+ unsigned long long threshold,
+ unsigned long long excess,
+ void *opaque)
+{
+ virQEMUDriverPtr driver = opaque;
+ virObjectEventPtr event = NULL;
+ virDomainDiskDefPtr disk;
+ virStorageSourcePtr src;
+ unsigned int idx;
+ char *dev = NULL;
+ const char *path = NULL;
+
+ virObjectLock(vm);
+
+ VIR_DEBUG("BLOCK_WRITE_THRESHOLD event for block node '%s' in domain %p
%s:"
+ "threshold '%llu' exceeded by '%llu'",
+ nodename, vm, vm->def->name, threshold, excess);
+
+ if ((disk = qemuDomainDiskLookupByNodename(vm->def, nodename, &src,
&idx))) {
+ if (virStorageSourceIsLocalStorage(src))
+ path = src->path;
+
+ if ((dev = qemuDomainDiskBackingStoreGetName(disk, src, idx))) {
+ event = virDomainEventBlockThresholdNewFromObj(vm, dev, path,
+ threshold, excess);
+ }
+ }
+
+ virObjectUnlock(vm);
+ qemuDomainEventQueue(driver, event);
+
+ return 0;
+}
+
+
+static int
qemuProcessHandleNicRxFilterChanged(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
const char *devAlias,
@@ -1634,6 +1673,7 @@ static qemuMonitorCallbacks monitorCallbacks = {
.domainMigrationStatus = qemuProcessHandleMigrationStatus,
.domainMigrationPass = qemuProcessHandleMigrationPass,
.domainAcpiOstInfo = qemuProcessHandleAcpiOstInfo,
+ .domainBlockThreshold = qemuProcessHandleBlockThreshold,
};
static void
--
2.11.1