|
|
7a3408 |
From 1bf327f3bea0116dabef57a58fb9127d7e3b0de5 Mon Sep 17 00:00:00 2001
|
|
|
7a3408 |
Message-Id: <1bf327f3bea0116dabef57a58fb9127d7e3b0de5@dist-git>
|
|
|
7a3408 |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
Date: Fri, 2 Oct 2015 12:08:26 +0200
|
|
|
7a3408 |
Subject: [PATCH] qemu: Wait until destination QEMU consumes all migration data
|
|
|
7a3408 |
|
|
|
7a3408 |
Even though QEMU on the source host reports completed migration and thus
|
|
|
7a3408 |
we move to the Finish phase, QEMU on the destination host may still be
|
|
|
7a3408 |
processing migration data. Thus before we can start guest CPUs on the
|
|
|
7a3408 |
destination, we have to wait for a completed migration event.
|
|
|
7a3408 |
|
|
|
7a3408 |
https://bugzilla.redhat.com/show_bug.cgi?id=1265902
|
|
|
7a3408 |
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
(cherry picked from commit be5347bb7223cab0a9f0713ed9c4bf5738a7e0ea)
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
|
|
|
7a3408 |
Conflicts:
|
|
|
7a3408 |
src/qemu/qemu_migration.c - missing qemuMigrationFinish
|
|
|
7a3408 |
refactoring
|
|
|
7a3408 |
---
|
|
|
7a3408 |
src/qemu/qemu_migration.c | 26 ++++++++++++++++++++++++++
|
|
|
7a3408 |
1 file changed, 26 insertions(+)
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
|
|
7a3408 |
index 83614f5..d3e024e 100644
|
|
|
7a3408 |
--- a/src/qemu/qemu_migration.c
|
|
|
7a3408 |
+++ b/src/qemu/qemu_migration.c
|
|
|
7a3408 |
@@ -5710,6 +5710,32 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
|
|
|
7a3408 |
event = NULL;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
|
|
|
7a3408 |
+ /* We need to wait for QEMU to process all data sent by the source
|
|
|
7a3408 |
+ * before starting guest CPUs.
|
|
|
7a3408 |
+ */
|
|
|
7a3408 |
+ if (!(flags & VIR_MIGRATE_OFFLINE) &&
|
|
|
7a3408 |
+ virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT)) {
|
|
|
7a3408 |
+ int rv;
|
|
|
7a3408 |
+ VIR_DEBUG("Waiting for migration to complete");
|
|
|
7a3408 |
+ while ((rv = qemuMigrationCompleted(driver, vm,
|
|
|
7a3408 |
+ QEMU_ASYNC_JOB_MIGRATION_IN,
|
|
|
7a3408 |
+ NULL, 0)) != 1) {
|
|
|
7a3408 |
+ if (rv < 0 || virDomainObjWait(vm) < 0) {
|
|
|
7a3408 |
+ /* There's not much we can do for v2 protocol since the
|
|
|
7a3408 |
+ * original domain on the source host is already gone.
|
|
|
7a3408 |
+ */
|
|
|
7a3408 |
+ if (v3proto) {
|
|
|
7a3408 |
+ qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED,
|
|
|
7a3408 |
+ VIR_QEMU_PROCESS_STOP_MIGRATED);
|
|
|
7a3408 |
+ virDomainAuditStop(vm, "failed");
|
|
|
7a3408 |
+ goto endjob;
|
|
|
7a3408 |
+ } else {
|
|
|
7a3408 |
+ break;
|
|
|
7a3408 |
+ }
|
|
|
7a3408 |
+ }
|
|
|
7a3408 |
+ }
|
|
|
7a3408 |
+ }
|
|
|
7a3408 |
+
|
|
|
7a3408 |
if (!(flags & VIR_MIGRATE_PAUSED) && !(flags & VIR_MIGRATE_OFFLINE)) {
|
|
|
7a3408 |
/* run 'cont' on the destination, which allows migration on qemu
|
|
|
7a3408 |
* >= 0.10.6 to work properly. This isn't strictly necessary on
|
|
|
7a3408 |
--
|
|
|
7a3408 |
2.6.1
|
|
|
7a3408 |
|