render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
6d3351
From 0c3a8fd16a2081ba0a07bf8c8bfdf26e4922da31 Mon Sep 17 00:00:00 2001
6d3351
Message-Id: <0c3a8fd16a2081ba0a07bf8c8bfdf26e4922da31@dist-git>
6d3351
From: Jiri Denemark <jdenemar@redhat.com>
6d3351
Date: Wed, 5 Apr 2017 14:48:43 +0200
6d3351
Subject: [PATCH] qemu: Introduce qemuMigrationReset
6d3351
6d3351
This new API is supposed to reset all migration parameters to make sure
6d3351
future migrations won't accidentally use them. This patch makes the
6d3351
first step and moves qemuMigrationResetTLS call inside
6d3351
qemuMigrationReset.
6d3351
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
(cherry picked from commit 439a1795fd3dc8a47ad794bf10a4c86a3ee14e61)
6d3351
6d3351
https://bugzilla.redhat.com/show_bug.cgi?id=1425003
6d3351
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
---
6d3351
 src/qemu/qemu_migration.c | 31 +++++++++++++++++++++++--------
6d3351
 src/qemu/qemu_migration.h |  5 +++++
6d3351
 src/qemu/qemu_process.c   |  4 ++--
6d3351
 3 files changed, 30 insertions(+), 10 deletions(-)
6d3351
6d3351
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
6d3351
index 6c9f14245..27156cc78 100644
6d3351
--- a/src/qemu/qemu_migration.c
6d3351
+++ b/src/qemu/qemu_migration.c
6d3351
@@ -2836,9 +2836,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
6d3351
     return ret;
6d3351
 
6d3351
  stopjob:
6d3351
-    ignore_value(qemuMigrationResetTLS(driver, vm,
6d3351
-                                       QEMU_ASYNC_JOB_MIGRATION_IN,
6d3351
-                                       tlsAlias, secAlias));
6d3351
+    qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN);
6d3351
 
6d3351
     if (stopProcess) {
6d3351
         unsigned int stopFlags = VIR_QEMU_PROCESS_STOP_MIGRATED;
6d3351
@@ -3216,8 +3214,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
6d3351
             qemuDomainEventQueue(driver, event);
6d3351
         }
6d3351
 
6d3351
-        qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
6d3351
-                              NULL, NULL);
6d3351
+        qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT);
6d3351
 
6d3351
         if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
6d3351
             VIR_WARN("Failed to save status on vm %s", vm->def->name);
6d3351
@@ -4830,8 +4827,7 @@ qemuMigrationPerformJob(virQEMUDriverPtr driver,
6d3351
      * here
6d3351
      */
6d3351
     if (!v3proto && ret < 0)
6d3351
-        qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
6d3351
-                              NULL, NULL);
6d3351
+        qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT);
6d3351
 
6d3351
     if (qemuMigrationRestoreDomainState(conn, vm)) {
6d3351
         event = virDomainEventLifecycleNewFromObj(vm,
6d3351
@@ -5362,7 +5358,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
6d3351
                                  QEMU_ASYNC_JOB_MIGRATION_IN);
6d3351
     }
6d3351
 
6d3351
-    qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN, NULL, NULL);
6d3351
+    qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN);
6d3351
 
6d3351
     qemuMigrationJobFinish(driver, vm);
6d3351
     if (!virDomainObjIsActive(vm))
6d3351
@@ -5875,3 +5871,22 @@ qemuMigrationCompressionDump(qemuMigrationCompressionPtr compression,
6d3351
 
6d3351
     return 0;
6d3351
 }
6d3351
+
6d3351
+
6d3351
+/*
6d3351
+ * qemuMigrationReset:
6d3351
+ *
6d3351
+ * Reset all migration parameters so that the next job which internally uses
6d3351
+ * migration (save, managedsave, snapshots, dump) will not try to use them.
6d3351
+ */
6d3351
+void
6d3351
+qemuMigrationReset(virQEMUDriverPtr driver,
6d3351
+                   virDomainObjPtr vm,
6d3351
+                   qemuDomainAsyncJob job)
6d3351
+{
6d3351
+    if (!virDomainObjIsActive(vm))
6d3351
+        return;
6d3351
+
6d3351
+    if (qemuMigrationResetTLS(driver, vm, job, NULL, NULL) < 0)
6d3351
+        return;
6d3351
+}
6d3351
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
6d3351
index 5248f399d..28eb55056 100644
6d3351
--- a/src/qemu/qemu_migration.h
6d3351
+++ b/src/qemu/qemu_migration.h
6d3351
@@ -285,4 +285,9 @@ qemuMigrationResetTLS(virQEMUDriverPtr driver,
6d3351
                       char *in_tlsAlias,
6d3351
                       char *in_secAlias);
6d3351
 
6d3351
+void
6d3351
+qemuMigrationReset(virQEMUDriverPtr driver,
6d3351
+                   virDomainObjPtr vm,
6d3351
+                   qemuDomainAsyncJob job);
6d3351
+
6d3351
 #endif /* __QEMU_MIGRATION_H__ */
6d3351
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
6d3351
index 2e0f859ce..027c831e6 100644
6d3351
--- a/src/qemu/qemu_process.c
6d3351
+++ b/src/qemu/qemu_process.c
6d3351
@@ -2982,7 +2982,7 @@ qemuProcessRecoverMigrationIn(virQEMUDriverPtr driver,
6d3351
         break;
6d3351
     }
6d3351
 
6d3351
-    qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_NONE, NULL, NULL);
6d3351
+    qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_NONE);
6d3351
     return 0;
6d3351
 }
6d3351
 
6d3351
@@ -3077,7 +3077,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
6d3351
         }
6d3351
     }
6d3351
 
6d3351
-    qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_NONE, NULL, NULL);
6d3351
+    qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_NONE);
6d3351
     return 0;
6d3351
 }
6d3351
 
6d3351
-- 
6d3351
2.12.2
6d3351