3e5111
From 0811efa2bcaae69e59fe09432083224e77eafa1d Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <0811efa2bcaae69e59fe09432083224e77eafa1d@dist-git>
3e5111
From: Jiri Denemark <jdenemar@redhat.com>
3e5111
Date: Wed, 5 Apr 2017 10:24:47 +0200
3e5111
Subject: [PATCH] qemu: Don't reset TLS in qemuMigrationRun
3e5111
3e5111
Finished qemuMigrationRun does not mean the migration itself finished
3e5111
(it might have just switched to post-copy mode). While resetting TLS
3e5111
parameters is probably OK at this point even if migration is still
3e5111
running, we want to consolidate the code which resets various migration
3e5111
parameters. Thus qemuMigrationResetTLS will be called from the Confirm
3e5111
phase (or at the end of the Perform phase in case of v2 protocol), when
3e5111
migration is either canceled or finished.
3e5111
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
(cherry picked from commit a88c250d8693ae198d42cf26e2b7b1e190e94637)
3e5111
3e5111
https://bugzilla.redhat.com/show_bug.cgi?id=1425003
3e5111
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
---
3e5111
 src/qemu/qemu_migration.c | 14 ++++++++++----
3e5111
 1 file changed, 10 insertions(+), 4 deletions(-)
3e5111
3e5111
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
3e5111
index 992b6bd4a..d8d89b011 100644
3e5111
--- a/src/qemu/qemu_migration.c
3e5111
+++ b/src/qemu/qemu_migration.c
3e5111
@@ -3216,6 +3216,9 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
3e5111
             qemuDomainEventQueue(driver, event);
3e5111
         }
3e5111
 
3e5111
+        qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
3e5111
+                              NULL, NULL);
3e5111
+
3e5111
         if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
3e5111
             VIR_WARN("Failed to save status on vm %s", vm->def->name);
3e5111
     }
3e5111
@@ -3848,10 +3851,6 @@ qemuMigrationRun(virQEMUDriverPtr driver,
3e5111
             ret = -1;
3e5111
     }
3e5111
 
3e5111
-    if (qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
3e5111
-                              tlsAlias, secAlias) < 0)
3e5111
-        ret = -1;
3e5111
-
3e5111
     VIR_FREE(tlsAlias);
3e5111
     VIR_FREE(secAlias);
3e5111
     virObjectUnref(cfg);
3e5111
@@ -4827,6 +4826,13 @@ qemuMigrationPerformJob(virQEMUDriverPtr driver,
3e5111
     if (ret < 0)
3e5111
         orig_err = virSaveLastError();
3e5111
 
3e5111
+    /* v2 proto has no confirm phase so we need to reset migration parameters
3e5111
+     * here
3e5111
+     */
3e5111
+    if (!v3proto && ret < 0)
3e5111
+        qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
3e5111
+                              NULL, NULL);
3e5111
+
3e5111
     if (qemuMigrationRestoreDomainState(conn, vm)) {
3e5111
         event = virDomainEventLifecycleNewFromObj(vm,
3e5111
                                          VIR_DOMAIN_EVENT_RESUMED,
3e5111
-- 
3e5111
2.12.2
3e5111