The corresponding event in QEMU is called MIGRATION_PASS.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
Notes:
This event requires QEMU 2.5.0 + "Migration: Small fixes and improvements"
series (
https://lists.gnu.org/archive/html/qemu-devel/2015-12/msg02579.html)
src/qemu/qemu_monitor.c | 13 +++++++++++++
src/qemu/qemu_monitor.h | 8 ++++++++
src/qemu/qemu_monitor_json.c | 17 +++++++++++++++++
src/qemu/qemu_process.c | 30 ++++++++++++++++++++++++++++++
4 files changed, 68 insertions(+)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 6fd08b6..6b23e88 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1494,6 +1494,19 @@ qemuMonitorEmitMigrationStatus(qemuMonitorPtr mon,
int
+qemuMonitorEmitMigrationPass(qemuMonitorPtr mon,
+ int pass)
+{
+ int ret = -1;
+ VIR_DEBUG("mon=%p, pass=%d", mon, pass);
+
+ QEMU_MONITOR_CALLBACK(mon, ret, domainMigrationPass, mon->vm, pass);
+
+ return ret;
+}
+
+
+int
qemuMonitorSetCapabilities(qemuMonitorPtr mon)
{
QEMU_CHECK_MONITOR(mon);
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 4193ad2..9d7d5f3 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -191,6 +191,11 @@ typedef int
(*qemuMonitorDomainMigrationStatusCallback)(qemuMonitorPtr mon,
int status,
void *opaque);
+typedef int (*qemuMonitorDomainMigrationPassCallback)(qemuMonitorPtr mon,
+ virDomainObjPtr vm,
+ int pass,
+ void *opaque);
+
typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks;
typedef qemuMonitorCallbacks *qemuMonitorCallbacksPtr;
struct _qemuMonitorCallbacks {
@@ -220,6 +225,7 @@ struct _qemuMonitorCallbacks {
qemuMonitorDomainSerialChangeCallback domainSerialChange;
qemuMonitorDomainSpiceMigratedCallback domainSpiceMigrated;
qemuMonitorDomainMigrationStatusCallback domainMigrationStatus;
+ qemuMonitorDomainMigrationPassCallback domainMigrationPass;
};
char *qemuMonitorEscapeArg(const char *in);
@@ -323,6 +329,8 @@ int qemuMonitorEmitSerialChange(qemuMonitorPtr mon,
int qemuMonitorEmitSpiceMigrated(qemuMonitorPtr mon);
int qemuMonitorEmitMigrationStatus(qemuMonitorPtr mon,
int status);
+int qemuMonitorEmitMigrationPass(qemuMonitorPtr mon,
+ int pass);
int qemuMonitorStartCPUs(qemuMonitorPtr mon,
virConnectPtr conn);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 077be3a..24a8865 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -86,6 +86,7 @@ static void qemuMonitorJSONHandleNicRxFilterChanged(qemuMonitorPtr mon,
virJSONV
static void qemuMonitorJSONHandleSerialChange(qemuMonitorPtr mon, virJSONValuePtr data);
static void qemuMonitorJSONHandleSpiceMigrated(qemuMonitorPtr mon, virJSONValuePtr
data);
static void qemuMonitorJSONHandleMigrationStatus(qemuMonitorPtr mon, virJSONValuePtr
data);
+static void qemuMonitorJSONHandleMigrationPass(qemuMonitorPtr mon, virJSONValuePtr
data);
typedef struct {
const char *type;
@@ -102,6 +103,7 @@ static qemuEventHandler eventHandlers[] = {
{ "DEVICE_TRAY_MOVED", qemuMonitorJSONHandleTrayChange, },
{ "GUEST_PANICKED", qemuMonitorJSONHandleGuestPanic, },
{ "MIGRATION", qemuMonitorJSONHandleMigrationStatus, },
+ { "MIGRATION_PASS", qemuMonitorJSONHandleMigrationPass, },
{ "NIC_RX_FILTER_CHANGED", qemuMonitorJSONHandleNicRxFilterChanged, },
{ "POWERDOWN", qemuMonitorJSONHandlePowerdown, },
{ "RESET", qemuMonitorJSONHandleReset, },
@@ -1008,6 +1010,21 @@ qemuMonitorJSONHandleMigrationStatus(qemuMonitorPtr mon,
}
+static void
+qemuMonitorJSONHandleMigrationPass(qemuMonitorPtr mon,
+ virJSONValuePtr data)
+{
+ int pass;
+
+ if (virJSONValueObjectGetNumberInt(data, "pass", &pass) < 0) {
+ VIR_WARN("missing dirty-sync-count in migration-pass event");
+ return;
+ }
+
+ qemuMonitorEmitMigrationPass(mon, pass);
+}
+
+
int
qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon,
const char *cmd_str,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 05cbda2..abb25e9 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1516,6 +1516,35 @@ qemuProcessHandleMigrationStatus(qemuMonitorPtr mon
ATTRIBUTE_UNUSED,
}
+static int
+qemuProcessHandleMigrationPass(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
+ virDomainObjPtr vm,
+ int pass,
+ void *opaque)
+{
+ virQEMUDriverPtr driver = opaque;
+ qemuDomainObjPrivatePtr priv;
+
+ virObjectLock(vm);
+
+ VIR_DEBUG("Migrating domain %p %s, iteration %d",
+ vm, vm->def->name, pass);
+
+ priv = vm->privateData;
+ if (priv->job.asyncJob == QEMU_ASYNC_JOB_NONE) {
+ VIR_DEBUG("got MIGRATION_PASS event without a migration job");
+ goto cleanup;
+ }
+
+ qemuDomainEventQueue(driver,
+ virDomainEventMigrationIterationNewFromObj(vm, pass));
+
+ cleanup:
+ virObjectUnlock(vm);
+ return 0;
+}
+
+
static qemuMonitorCallbacks monitorCallbacks = {
.eofNotify = qemuProcessHandleMonitorEOF,
.errorNotify = qemuProcessHandleMonitorError,
@@ -1541,6 +1570,7 @@ static qemuMonitorCallbacks monitorCallbacks = {
.domainSerialChange = qemuProcessHandleSerialChanged,
.domainSpiceMigrated = qemuProcessHandleSpiceMigrated,
.domainMigrationStatus = qemuProcessHandleMigrationStatus,
+ .domainMigrationPass = qemuProcessHandleMigrationPass,
};
static void
--
2.7.0