This new API is supposed to reset all migration parameters to make sure
future migrations won't accidentally use them. This patch makes the
first step and moves qemuMigrationResetTLS call inside
qemuMigrationReset.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_migration.c | 31 +++++++++++++++++++++++--------
src/qemu/qemu_migration.h | 5 +++++
src/qemu/qemu_process.c | 4 ++--
3 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 392632566..739b595ac 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2836,9 +2836,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
return ret;
stopjob:
- ignore_value(qemuMigrationResetTLS(driver, vm,
- QEMU_ASYNC_JOB_MIGRATION_IN,
- tlsAlias, secAlias));
+ qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN);
if (stopProcess) {
unsigned int stopFlags = VIR_QEMU_PROCESS_STOP_MIGRATED;
@@ -3216,8 +3214,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
qemuDomainEventQueue(driver, event);
}
- qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
- NULL, NULL);
+ qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT);
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps)
< 0)
VIR_WARN("Failed to save status on vm %s", vm->def->name);
@@ -4830,8 +4827,7 @@ qemuMigrationPerformJob(virQEMUDriverPtr driver,
* here
*/
if (!v3proto && ret < 0)
- qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
- NULL, NULL);
+ qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT);
if (qemuMigrationRestoreDomainState(conn, vm)) {
event = virDomainEventLifecycleNewFromObj(vm,
@@ -5362,7 +5358,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
QEMU_ASYNC_JOB_MIGRATION_IN);
}
- qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN, NULL, NULL);
+ qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN);
qemuMigrationJobFinish(driver, vm);
if (!virDomainObjIsActive(vm))
@@ -5875,3 +5871,22 @@ qemuMigrationCompressionDump(qemuMigrationCompressionPtr
compression,
return 0;
}
+
+
+/*
+ * qemuMigrationReset:
+ *
+ * Reset all migration parameters so that the next job which internally uses
+ * migration (save, managedsave, snapshots, dump) will not try to use them.
+ */
+void
+qemuMigrationReset(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ qemuDomainAsyncJob job)
+{
+ if (!virDomainObjIsActive(vm))
+ return;
+
+ if (qemuMigrationResetTLS(driver, vm, job, NULL, NULL) < 0)
+ return;
+}
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 5248f399d..28eb55056 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -285,4 +285,9 @@ qemuMigrationResetTLS(virQEMUDriverPtr driver,
char *in_tlsAlias,
char *in_secAlias);
+void
+qemuMigrationReset(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ qemuDomainAsyncJob job);
+
#endif /* __QEMU_MIGRATION_H__ */
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 935993f16..18ff1e143 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2982,7 +2982,7 @@ qemuProcessRecoverMigrationIn(virQEMUDriverPtr driver,
break;
}
- qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_NONE, NULL, NULL);
+ qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_NONE);
return 0;
}
@@ -3077,7 +3077,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
}
}
- qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_NONE, NULL, NULL);
+ qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_NONE);
return 0;
}
--
2.12.2