diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 8bd39c729b6b28f463962ead8e16ba98a2f0f086..763d15684b4b0e010224f08583fa008ecd19ed04 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -363,6 +363,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"pcie-root-port",
"query-cpu-definitions", /* 250 */
+ "block-write-threshold",
);
@@ -1534,6 +1535,7 @@ struct virQEMUCapsStringFlags virQEMUCapsEvents[] = {
{ "MIGRATION", QEMU_CAPS_MIGRATION_EVENT },
{ "VSERPORT_CHANGE", QEMU_CAPS_VSERPORT_CHANGE },
{ "DEVICE_TRAY_MOVED", QEMU_CAPS_DEVICE_TRAY_MOVED },
+ { "BLOCK_WRITE_THRESHOLD", QEMU_CAPS_BLOCK_WRITE_THRESHOLD },
};
struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 55777f979b210c803b0dd2a62ebf32cd9f44caa6..ac732f3aee66d815f11a832ac645bacf2f98f358 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -399,6 +399,7 @@ typedef enum {
/* 250 */
QEMU_CAPS_QUERY_CPU_DEFINITIONS, /* qmp query-cpu-definitions */
+ QEMU_CAPS_BLOCK_WRITE_THRESHOLD, /* BLOCK_WRITE_THRESHOLD event */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 8889eae8265a2ce0af7cb9a8d51e75ef460dacfb..a85eacfee4c81f247fdb9b96b6ab6887a3d21eec 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1604,6 +1604,24 @@ qemuMonitorEmitAcpiOstInfo(qemuMonitorPtr mon,
}
+int
+qemuMonitorEmitBlockThreshold(qemuMonitorPtr mon,
+ const char *nodename,
+ unsigned long long threshold,
+ unsigned long long excess)
+{
+ int ret = -1;
+
+ VIR_DEBUG("mon=%p, node-name='%s', threshold='%llu', excess='%llu'",
+ mon, nodename, threshold, excess);
+
+ QEMU_MONITOR_CALLBACK(mon, ret, domainBlockThreshold, mon->vm,
+ nodename, threshold, excess);
+
+ return ret;
+}
+
+
int
qemuMonitorSetCapabilities(qemuMonitorPtr mon)
{
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index b23a98b3b574eda9c59a47e975aff9849d9ede3b..3270baba0437e57af98ca2e26f0fdf53d4234a95 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -207,6 +207,14 @@ typedef int (*qemuMonitorDomainAcpiOstInfoCallback)(qemuMonitorPtr mon,
void *opaque);
+typedef int (*qemuMonitorDomainBlockThresholdCallback)(qemuMonitorPtr mon,
+ virDomainObjPtr vm,
+ const char *nodename,
+ unsigned long long threshold,
+ unsigned long long excess,
+ void *opaque);
+
+
typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks;
typedef qemuMonitorCallbacks *qemuMonitorCallbacksPtr;
struct _qemuMonitorCallbacks {
@@ -238,6 +246,7 @@ struct _qemuMonitorCallbacks {
qemuMonitorDomainMigrationStatusCallback domainMigrationStatus;
qemuMonitorDomainMigrationPassCallback domainMigrationPass;
qemuMonitorDomainAcpiOstInfoCallback domainAcpiOstInfo;
+ qemuMonitorDomainBlockThresholdCallback domainBlockThreshold;
};
char *qemuMonitorEscapeArg(const char *in);
@@ -358,6 +367,11 @@ int qemuMonitorEmitAcpiOstInfo(qemuMonitorPtr mon,
unsigned int source,
unsigned int status);
+int qemuMonitorEmitBlockThreshold(qemuMonitorPtr mon,
+ const char *nodename,
+ unsigned long long threshold,
+ unsigned long long excess);
+
int qemuMonitorStartCPUs(qemuMonitorPtr mon,
virConnectPtr conn);
int qemuMonitorStopCPUs(qemuMonitorPtr mon);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index e45d5fbfc7de41eb5cac02a4bf1d355ee38da4d7..f95afd1ed61655493ba896635072880e5ed61c94 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -89,6 +89,7 @@ static void qemuMonitorJSONHandleSpiceMigrated(qemuMonitorPtr mon, virJSONValueP
static void qemuMonitorJSONHandleMigrationStatus(qemuMonitorPtr mon, virJSONValuePtr data);
static void qemuMonitorJSONHandleMigrationPass(qemuMonitorPtr mon, virJSONValuePtr data);
static void qemuMonitorJSONHandleAcpiOstInfo(qemuMonitorPtr mon, virJSONValuePtr data);
+static void qemuMonitorJSONHandleBlockThreshold(qemuMonitorPtr mon, virJSONValuePtr data);
typedef struct {
const char *type;
@@ -102,6 +103,7 @@ static qemuEventHandler eventHandlers[] = {
{ "BLOCK_JOB_CANCELLED", qemuMonitorJSONHandleBlockJobCanceled, },
{ "BLOCK_JOB_COMPLETED", qemuMonitorJSONHandleBlockJobCompleted, },
{ "BLOCK_JOB_READY", qemuMonitorJSONHandleBlockJobReady, },
+ { "BLOCK_WRITE_THRESHOLD", qemuMonitorJSONHandleBlockThreshold, },
{ "DEVICE_DELETED", qemuMonitorJSONHandleDeviceDeleted, },
{ "DEVICE_TRAY_MOVED", qemuMonitorJSONHandleTrayChange, },
{ "GUEST_PANICKED", qemuMonitorJSONHandleGuestPanic, },
@@ -1065,6 +1067,30 @@ qemuMonitorJSONHandleAcpiOstInfo(qemuMonitorPtr mon, virJSONValuePtr data)
}
+static void
+qemuMonitorJSONHandleBlockThreshold(qemuMonitorPtr mon, virJSONValuePtr data)
+{
+ const char *nodename;
+ unsigned long long threshold;
+ unsigned long long excess;
+
+ if (!(nodename = virJSONValueObjectGetString(data, "node-name")))
+ goto error;
+
+ if (virJSONValueObjectGetNumberUlong(data, "write-threshold", &threshold) < 0)
+ goto error;
+
+ if (virJSONValueObjectGetNumberUlong(data, "amount-exceeded", &excess) < 0)
+ goto error;
+
+ qemuMonitorEmitBlockThreshold(mon, nodename, threshold, excess);
+ return;
+
+ error:
+ VIR_WARN("malformed 'BLOCK_WRITE_THRESHOLD' event");
+}
+
+
int
qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon,
const char *cmd_str,
diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
index a348bc3d17c9af4cee76a3b6918e548d36479ebe..59353f7b54754fb90fb9ed670370c3a1828a9ac3 100644
--- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
@@ -183,6 +183,7 @@
+
2004000
0
diff --git a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
index f198715a0c163a97ad61d204225de04e938a070b..8c5c22c49969b1dc5c500d323b820a6ce64c652f 100644
--- a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
@@ -189,6 +189,7 @@
+
2005000
0
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
index f45560b1c65a570b34d1e8edd65e11fab0ccd8db..ef962992d3fd452aaed4dd06b90ed81a4bcb0283 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
@@ -165,6 +165,7 @@
+
2006000
0
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
index 721c97be0bcd7cb656f404fe960652fcce8dc625..48f1d6c5fe71ffa099ba8bd0b95a8ea78db0539a 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
@@ -165,6 +165,7 @@
+
2006000
0
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml
index f1c5105be99c40c070cd6545ae0ad219b8b3357b..94a0f6da7dd869e2130c98602d7312fc9dcf8e02 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml
@@ -160,6 +160,7 @@
+
2006000
0
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
index 74b8e9aef8cd7a02a1bc521a511bc59d6650b28c..43ac515eb0243b1c972dd3330f90dc7a167f7ddd 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
@@ -198,6 +198,7 @@
+
2006000
0
diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml
index 4c45b3805be4197116b77220139b67c5556327d6..83281a7d28ca580d1683c9e4938ee8069b9f2a21 100644
--- a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml
@@ -128,6 +128,7 @@
+
2007000
0
diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
index d6b589cd2f2a4f272c1ed6c19104c5d0f0a759bb..be5431a398f51bfea168aa1efaaf6317101479c4 100644
--- a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml
@@ -200,6 +200,7 @@
+
2007000
0
(v2.7.0)
diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
index 215159cd170118da86f73906ec50dd48284fa470..776c6f8ee7c5386fce9fea1790f3dc26246ef72f 100644
--- a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
@@ -130,6 +130,7 @@
+
2007093
0
diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
index a4a97a7e04e5132f6c44af5fd613fb376424fc6c..c376653e2014f6d0536c49ddeeda71868ea2cc76 100644
--- a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml
@@ -201,6 +201,7 @@
+
2008000
0
(v2.8.0)
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
index f1adb4ddc9152d2e7025c159330f8f4febdb1c13..e703405e5514b68ae2334a8a7f675d6b9eb2454e 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
@@ -205,6 +205,7 @@
+
2008090
0
(v2.9.0-rc0-142-g940a8ce)