qemu: Introduce qemuMigrationReset

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@redhat.com>
This commit is contained in:
Jiri Denemark 2017-04-05 14:48:43 +02:00
parent 133c73e75f
commit 439a1795fd
3 changed files with 30 additions and 10 deletions

View File

@ -2836,9 +2836,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
return ret; return ret;
stopjob: stopjob:
ignore_value(qemuMigrationResetTLS(driver, vm, qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN);
QEMU_ASYNC_JOB_MIGRATION_IN,
tlsAlias, secAlias));
if (stopProcess) { if (stopProcess) {
unsigned int stopFlags = VIR_QEMU_PROCESS_STOP_MIGRATED; unsigned int stopFlags = VIR_QEMU_PROCESS_STOP_MIGRATED;
@ -3216,8 +3214,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
qemuDomainEventQueue(driver, event); qemuDomainEventQueue(driver, event);
} }
qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT);
NULL, NULL);
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
VIR_WARN("Failed to save status on vm %s", vm->def->name); VIR_WARN("Failed to save status on vm %s", vm->def->name);
@ -4830,8 +4827,7 @@ qemuMigrationPerformJob(virQEMUDriverPtr driver,
* here * here
*/ */
if (!v3proto && ret < 0) if (!v3proto && ret < 0)
qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT, qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT);
NULL, NULL);
if (qemuMigrationRestoreDomainState(conn, vm)) { if (qemuMigrationRestoreDomainState(conn, vm)) {
event = virDomainEventLifecycleNewFromObj(vm, event = virDomainEventLifecycleNewFromObj(vm,
@ -5362,7 +5358,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
QEMU_ASYNC_JOB_MIGRATION_IN); 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); qemuMigrationJobFinish(driver, vm);
if (!virDomainObjIsActive(vm)) if (!virDomainObjIsActive(vm))
@ -5875,3 +5871,22 @@ qemuMigrationCompressionDump(qemuMigrationCompressionPtr compression,
return 0; 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;
}

View File

@ -321,4 +321,9 @@ qemuMigrationResetTLS(virQEMUDriverPtr driver,
char *in_tlsAlias, char *in_tlsAlias,
char *in_secAlias); char *in_secAlias);
void
qemuMigrationReset(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuDomainAsyncJob job);
#endif /* __QEMU_MIGRATION_H__ */ #endif /* __QEMU_MIGRATION_H__ */

View File

@ -2982,7 +2982,7 @@ qemuProcessRecoverMigrationIn(virQEMUDriverPtr driver,
break; break;
} }
qemuMigrationResetTLS(driver, vm, QEMU_ASYNC_JOB_NONE, NULL, NULL); qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_NONE);
return 0; 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; return 0;
} }