mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 15:15:25 +00:00
qemu: Enable migration events on QMP monitor
Even if QEMU supports migration events it doesn't send them by default. We have to enable them by calling migrate-set-capabilities. Let's enable migration events everytime we can and clear QEMU_CAPS_MIGRATION_EVENT in case migrate-set-capabilities does not support events. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
a60ee613c4
commit
3df4d2a45a
@ -163,7 +163,7 @@ VIR_ENUM_IMPL(qemuMonitorMigrationStatus,
|
|||||||
|
|
||||||
VIR_ENUM_IMPL(qemuMonitorMigrationCaps,
|
VIR_ENUM_IMPL(qemuMonitorMigrationCaps,
|
||||||
QEMU_MONITOR_MIGRATION_CAPS_LAST,
|
QEMU_MONITOR_MIGRATION_CAPS_LAST,
|
||||||
"xbzrle", "auto-converge", "rdma-pin-all")
|
"xbzrle", "auto-converge", "rdma-pin-all", "events")
|
||||||
|
|
||||||
VIR_ENUM_IMPL(qemuMonitorVMStatus,
|
VIR_ENUM_IMPL(qemuMonitorVMStatus,
|
||||||
QEMU_MONITOR_VM_STATUS_LAST,
|
QEMU_MONITOR_VM_STATUS_LAST,
|
||||||
|
@ -512,6 +512,7 @@ typedef enum {
|
|||||||
QEMU_MONITOR_MIGRATION_CAPS_XBZRLE,
|
QEMU_MONITOR_MIGRATION_CAPS_XBZRLE,
|
||||||
QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE,
|
QEMU_MONITOR_MIGRATION_CAPS_AUTO_CONVERGE,
|
||||||
QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL,
|
QEMU_MONITOR_MIGRATION_CAPS_RDMA_PIN_ALL,
|
||||||
|
QEMU_MONITOR_MIGRATION_CAPS_EVENTS,
|
||||||
|
|
||||||
QEMU_MONITOR_MIGRATION_CAPS_LAST
|
QEMU_MONITOR_MIGRATION_CAPS_LAST
|
||||||
} qemuMonitorMigrationCaps;
|
} qemuMonitorMigrationCaps;
|
||||||
|
@ -1548,7 +1548,7 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob,
|
|||||||
vm->def) < 0) {
|
vm->def) < 0) {
|
||||||
VIR_ERROR(_("Failed to set security context for monitor for %s"),
|
VIR_ERROR(_("Failed to set security context for monitor for %s"),
|
||||||
vm->def->name);
|
vm->def->name);
|
||||||
goto error;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hold an extra reference because we can't allow 'vm' to be
|
/* Hold an extra reference because we can't allow 'vm' to be
|
||||||
@ -1580,26 +1580,38 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob,
|
|||||||
if (virSecurityManagerClearSocketLabel(driver->securityManager, vm->def) < 0) {
|
if (virSecurityManagerClearSocketLabel(driver->securityManager, vm->def) < 0) {
|
||||||
VIR_ERROR(_("Failed to clear security context for monitor for %s"),
|
VIR_ERROR(_("Failed to clear security context for monitor for %s"),
|
||||||
vm->def->name);
|
vm->def->name);
|
||||||
goto error;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->mon == NULL) {
|
if (priv->mon == NULL) {
|
||||||
VIR_INFO("Failed to connect monitor for %s", vm->def->name);
|
VIR_INFO("Failed to connect monitor for %s", vm->def->name);
|
||||||
goto error;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||||
goto error;
|
|
||||||
ret = qemuMonitorSetCapabilities(priv->mon);
|
|
||||||
if (ret == 0 &&
|
|
||||||
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON))
|
|
||||||
ret = virQEMUCapsProbeQMP(priv->qemuCaps, priv->mon);
|
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
error:
|
if (qemuMonitorSetCapabilities(priv->mon) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON) &&
|
||||||
|
virQEMUCapsProbeQMP(priv->qemuCaps, priv->mon) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT) &&
|
||||||
|
qemuMonitorSetMigrationCapability(priv->mon,
|
||||||
|
QEMU_MONITOR_MIGRATION_CAPS_EVENTS,
|
||||||
|
true) < 0) {
|
||||||
|
VIR_DEBUG("Cannot enable migration events; clearing capability");
|
||||||
|
virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||||
|
ret = -1;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user