From: zhengchuan <zhengchuan(a)huawei.com>
add qemu monitor callback functions
Signed-off-by:zhengchuan<zhengchuan@huawei.com>
---
src/qemu/qemu_monitor.c | 10 ++++++++++
src/qemu/qemu_monitor.h | 6 ++++++
src/qemu/qemu_monitor_json.c | 16 ++++++++++++++++
3 files changed, 32 insertions(+)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 36ec923861..17f00f13fd 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1390,6 +1390,16 @@ qemuMonitorEmitMigrationPid(qemuMonitor *mon,
}
+void
+qemuMonitorEmitMigrationMultiFdPids(qemuMonitor *mon,
+ int mpid)
+{
+ VIR_DEBUG("mon=%p, pass=%d", mon, mpid);
+
+ QEMU_MONITOR_CALLBACK(mon, domainMigrationMultiFdPids, mon->vm, mpid);
+}
+
+
void
qemuMonitorEmitRdmaGidStatusChanged(qemuMonitor *mon,
const char *netdev,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 4eddd79779..f19f94eaf0 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -366,6 +366,10 @@ typedef int (*qemuMonitorDomainMigrationPidCallback)(qemuMonitor
*mon,
virDomainObj *vm,
int mcpid);
+typedef int (*qemuMonitorDomainMigrationMultiFdPidsCallback)(qemuMonitor *mon,
+ virDomainObj *vm,
+ int mcpid);
+
typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks;
struct _qemuMonitorCallbacks {
qemuMonitorEofNotifyCallback eofNotify;
@@ -402,6 +406,7 @@ struct _qemuMonitorCallbacks {
qemuMonitorDomainMemoryDeviceSizeChange domainMemoryDeviceSizeChange;
qemuMonitorDomainDeviceUnplugErrCallback domainDeviceUnplugError;
qemuMonitorDomainMigrationPidCallback domainMigrationPid;
+ qemuMonitorDomainMigrationMultiFdPidsCallback domainMigrationMultiFdPids;
};
qemuMonitor *qemuMonitorOpen(virDomainObj *vm,
@@ -505,6 +510,7 @@ void qemuMonitorEmitMigrationPass(qemuMonitor *mon,
int pass);
void qemuMonitorEmitMigrationPid(qemuMonitor *mon, int mpid);
+void qemuMonitorEmitMigrationMultiFdPids(qemuMonitor *mon, int mpid);
void qemuMonitorEmitAcpiOstInfo(qemuMonitor *mon,
const char *alias,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 3129305107..1fc8c23518 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -85,6 +85,7 @@ static void qemuMonitorJSONHandleMemoryFailure(qemuMonitor *mon,
virJSONValue *d
static void qemuMonitorJSONHandleMemoryDeviceSizeChange(qemuMonitor *mon, virJSONValue
*data);
static void qemuMonitorJSONHandleDeviceUnplugErr(qemuMonitor *mon, virJSONValue *data);
static void qemuMonitorJSONHandleMigrationPid(qemuMonitor *mon, virJSONValue *data);
+static void qemuMonitorJSONHandleMigrationMultiFdPids(qemuMonitor *mon, virJSONValue
*data);
typedef struct {
const char *type;
@@ -106,6 +107,7 @@ static qemuEventHandler eventHandlers[] = {
{ "MEMORY_DEVICE_SIZE_CHANGE", qemuMonitorJSONHandleMemoryDeviceSizeChange,
},
{ "MEMORY_FAILURE", qemuMonitorJSONHandleMemoryFailure, },
{ "MIGRATION", qemuMonitorJSONHandleMigrationStatus, },
+ { "MIGRATION_MULTIFD_PID", qemuMonitorJSONHandleMigrationMultiFdPids, },
{ "MIGRATION_PASS", qemuMonitorJSONHandleMigrationPass, },
{ "MIGRATION_PID", qemuMonitorJSONHandleMigrationPid, },
{ "NIC_RX_FILTER_CHANGED", qemuMonitorJSONHandleNicRxFilterChanged, },
@@ -145,6 +147,20 @@ qemuMonitorJSONHandleMigrationPid(qemuMonitor *mon,
qemuMonitorEmitMigrationPid(mon, mpid);
}
+static void
+qemuMonitorJSONHandleMigrationMultiFdPids(qemuMonitor *mon,
+ virJSONValue *data)
+{
+ int mpid;
+
+ if (virJSONValueObjectGetNumberInt(data, "pid", &mpid) < 0) {
+ VIR_WARN("missing multifd pid in migration-multifd-pid event");
+ return;
+ }
+
+ qemuMonitorEmitMigrationMultiFdPids(mon, mpid);
+}
+
static int
qemuMonitorEventCompare(const void *key, const void *elt)
{
--
2.33.0