On Tue, Sep 30, 2014 at 16:39:28 +0200, Cristian Klein wrote:
Signed-off-by: Cristian Klein <cristian.klein(a)cs.umu.se>
---
src/qemu/qemu_driver.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3fe2216..1242b77 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11950,6 +11950,55 @@ qemuDomainGetJobStats(virDomainPtr dom,
}
+static int qemuDomainMigrateStartPostCopy(virDomainPtr dom,
+ unsigned int flags)
+{
+ virQEMUDriverPtr driver = dom->conn->privateData;
+ virDomainObjPtr vm;
+ int ret = -1;
+ qemuDomainObjPrivatePtr priv;
+
+ virCheckFlags(0, -1);
+
+ if (!(vm = qemuDomObjFromDomain(dom)))
+ goto cleanup;
return -1;
+
+ if (virDomainMigrateStartPostCopyEnsureACL(dom->conn, vm->def) < 0)
+ return -1;
goto cleanup;
+
+ if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MIGRATION_OP) < 0)
+ goto cleanup;
+
+ if (!virDomainObjIsActive(vm)) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
+ goto endjob;
+ }
+
+ priv = vm->privateData;
+
+ if (priv->job.asyncJob != QEMU_ASYNC_JOB_MIGRATION_OUT) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("post-copy can only be started "
+ "while migration is in progress"));
+ goto cleanup;
goto endjob;
+ }
Do we need to explicitly check that post-copy was activated or is the
error we get from qemuMonitorMigrateStartPostCopy in such case good
enough?
+
+ VIR_DEBUG("Starting post-copy");
+ qemuDomainObjEnterMonitor(driver, vm);
+ ret = qemuMonitorMigrateStartPostCopy(priv->mon);
+ qemuDomainObjExitMonitor(driver, vm);
+
+ endjob:
+ if (!qemuDomainObjEndJob(driver, vm))
+ vm = NULL;
+
+ cleanup:
+ if (vm)
+ virObjectUnlock(vm);
+ return ret;
+}
+
static int qemuDomainAbortJob(virDomainPtr dom)
{
virQEMUDriverPtr driver = dom->conn->privateData;
@@ -18419,6 +18468,7 @@ static virDriver qemuDriver = {
.connectGetDomainCapabilities = qemuConnectGetDomainCapabilities, /* 1.2.7 */
.connectGetAllDomainStats = qemuConnectGetAllDomainStats, /* 1.2.8 */
.nodeAllocPages = qemuNodeAllocPages, /* 1.2.9 */
+ .domainMigrateStartPostCopy = qemuDomainMigrateStartPostCopy, /* 1.2.10 */
};
Jirka