[PATCH v2 7/8] Implement virDomainMigrateStartPostCopy in qemu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Cristian Klein <cristian.klein@xxxxxxxxx>
---
 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;
+
+    if (virDomainMigrateStartPostCopyEnsureACL(dom->conn, vm->def) < 0)
+        return -1;
+
+    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;
+    }
+
+    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 */
 };
 
 
-- 
1.9.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]