render / rpms / libvirt

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