|
|
7a3408 |
From ddad58d06d082ce9522de4139f3768e02de39309 Mon Sep 17 00:00:00 2001
|
|
|
7a3408 |
Message-Id: <ddad58d06d082ce9522de4139f3768e02de39309@dist-git>
|
|
|
7a3408 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
Date: Tue, 7 Jul 2015 18:17:25 +0200
|
|
|
7a3408 |
Subject: [PATCH] qemu: Enable migration events on QMP monitor
|
|
|
7a3408 |
|
|
|
7a3408 |
Even if QEMU supports migration events it doesn't send them by default.
|
|
|
7a3408 |
We have to enable them by calling migrate-set-capabilities. Let's enable
|
|
|
7a3408 |
migration events everytime we can and clear QEMU_CAPS_MIGRATION_EVENT in
|
|
|
7a3408 |
case migrate-set-capabilities does not support events.
|
|
|
7a3408 |
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
(cherry picked from commit 3df4d2a45aaafd0fe2191c648c83a609726638f7)
|
|
|
7a3408 |
|
|
|
7a3408 |
https://bugzilla.redhat.com/show_bug.cgi?id=1212077
|
|
|
7a3408 |
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
---
|
|
|
7a3408 |
src/qemu/qemu_monitor.c | 2 +-
|
|
|
7a3408 |
src/qemu/qemu_monitor.h | 1 +
|
|
|
7a3408 |
src/qemu/qemu_process.c | 36 ++++++++++++++++++++++++------------
|
|
|
7a3408 |
3 files changed, 26 insertions(+), 13 deletions(-)
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
|
|
|
7a3408 |
index dd742cf..d7d211e 100644
|
|
|
7a3408 |
--- a/src/qemu/qemu_monitor.c
|
|
|
7a3408 |
+++ b/src/qemu/qemu_monitor.c
|
|
|
7a3408 |
@@ -163,7 +163,7 @@ VIR_ENUM_IMPL(qemuMonitorMigrationStatus,
|
|
|
7a3408 |
|
|
|
7a3408 |
VIR_ENUM_IMPL(qemuMonitorMigrationCaps,
|
|
|
7a3408 |
QEMU_MONITOR_MIGRATION_CAPS_LAST,
|
|
|
7a3408 |
- "xbzrle", "auto-converge", "rdma-pin-all")
|
|
|
7a3408 |
+ "xbzrle", "auto-converge", "rdma-pin-all", "events")
|
|
|
7a3408 |
|
|
|
7a3408 |
VIR_ENUM_IMPL(qemuMonitorVMStatus,
|
|
|
7a3408 |
QEMU_MONITOR_VM_STATUS_LAST,
|
|
|
7a3408 |
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
|
|
|
7a3408 |
index d2b2f94..2ceba28 100644
|
|
|
7a3408 |
--- a/src/qemu/qemu_monitor.h
|
|
|
7a3408 |
+++ b/src/qemu/qemu_monitor.h
|
|
|
7a3408 |
@@ -512,6 +512,7 @@ typedef enum {
|
|
|
7a3408 |
QEMU_MONITOR_MIGRATION_CAPS_XBZRLE,
|
|
|
7a3408 |
QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE,
|
|
|
7a3408 |
QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL,
|
|
|
7a3408 |
+ QEMU_MONITOR_MIGRATION_CAPS_EVENTS,
|
|
|
7a3408 |
|
|
|
7a3408 |
QEMU_MONITOR_MIGRATION_CAPS_LAST
|
|
|
7a3408 |
} qemuMonitorMigrationCaps;
|
|
|
7a3408 |
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
|
7a3408 |
index ba84182..1d223d3 100644
|
|
|
7a3408 |
--- a/src/qemu/qemu_process.c
|
|
|
7a3408 |
+++ b/src/qemu/qemu_process.c
|
|
|
7a3408 |
@@ -1546,7 +1546,7 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob,
|
|
|
7a3408 |
vm->def) < 0) {
|
|
|
7a3408 |
VIR_ERROR(_("Failed to set security context for monitor for %s"),
|
|
|
7a3408 |
vm->def->name);
|
|
|
7a3408 |
- goto error;
|
|
|
7a3408 |
+ return -1;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
|
|
|
7a3408 |
/* Hold an extra reference because we can't allow 'vm' to be
|
|
|
7a3408 |
@@ -1578,26 +1578,38 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob,
|
|
|
7a3408 |
if (virSecurityManagerClearSocketLabel(driver->securityManager, vm->def) < 0) {
|
|
|
7a3408 |
VIR_ERROR(_("Failed to clear security context for monitor for %s"),
|
|
|
7a3408 |
vm->def->name);
|
|
|
7a3408 |
- goto error;
|
|
|
7a3408 |
+ return -1;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
|
|
|
7a3408 |
if (priv->mon == NULL) {
|
|
|
7a3408 |
VIR_INFO("Failed to connect monitor for %s", vm->def->name);
|
|
|
7a3408 |
- goto error;
|
|
|
7a3408 |
+ return -1;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
|
|
|
7a3408 |
|
|
|
7a3408 |
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
|
|
7a3408 |
- goto error;
|
|
|
7a3408 |
- ret = qemuMonitorSetCapabilities(priv->mon);
|
|
|
7a3408 |
- if (ret == 0 &&
|
|
|
7a3408 |
- virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON))
|
|
|
7a3408 |
- ret = virQEMUCapsProbeQMP(priv->qemuCaps, priv->mon);
|
|
|
7a3408 |
+ return -1;
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ if (qemuMonitorSetCapabilities(priv->mon) < 0)
|
|
|
7a3408 |
+ goto cleanup;
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON) &&
|
|
|
7a3408 |
+ virQEMUCapsProbeQMP(priv->qemuCaps, priv->mon) < 0)
|
|
|
7a3408 |
+ goto cleanup;
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT) &&
|
|
|
7a3408 |
+ qemuMonitorSetMigrationCapability(priv->mon,
|
|
|
7a3408 |
+ QEMU_MONITOR_MIGRATION_CAPS_EVENTS,
|
|
|
7a3408 |
+ true) < 0) {
|
|
|
7a3408 |
+ VIR_DEBUG("Cannot enable migration events; clearing capability");
|
|
|
7a3408 |
+ virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
|
|
|
7a3408 |
+ }
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ ret = 0;
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ cleanup:
|
|
|
7a3408 |
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
|
|
7a3408 |
- return -1;
|
|
|
7a3408 |
-
|
|
|
7a3408 |
- error:
|
|
|
7a3408 |
-
|
|
|
7a3408 |
+ ret = -1;
|
|
|
7a3408 |
return ret;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
|
|
|
7a3408 |
--
|
|
|
7a3408 |
2.4.5
|
|
|
7a3408 |
|