libxl: Don't attempt to resume domain on canceled migration

For unknown reasons, the libxl driver attempts to resume a domain in the
confirm phase when a migration operation has been canceled. This has shown
to be problematic when simulating scenarios that result in a canceled
migration. In all scenarios, the domain was in a running state when entering
libxlDomainMigrationSrcConfirm, causing the call to libxl_domain_resume to
fail. Making matters worse, the domain state is changed to paused when in
fact it's running. And finally, libxlDomainMigrationSrcConfirm incorrectly
returns an error.

Remove this incorrect logic from libxlDomainMigrationSrcConfirm. On a
canceled migration it's sufficient to resume the lock process that was
paused in the perform phase.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Jim Fehlig 2023-07-11 10:35:32 -06:00
parent ded44a0406
commit f3ed5c2713

View File

@ -1342,7 +1342,6 @@ libxlDomainMigrationSrcConfirm(libxlDriverPrivate *driver,
libxlDriverConfig *cfg = libxlDriverConfigGet(driver);
libxlDomainObjPrivate *priv = vm->privateData;
virObjectEvent *event = NULL;
int ret = -1;
if (cancelled) {
/* Resume lock process that was paused in MigrationSrcPerform */
@ -1351,17 +1350,6 @@ libxlDomainMigrationSrcConfirm(libxlDriverPrivate *driver,
vm,
priv->lockState);
priv->lockProcessRunning = true;
if (libxl_domain_resume(cfg->ctx, vm->def->id, 1, 0) == 0) {
ret = 0;
} else {
VIR_DEBUG("Unable to resume domain '%s' after failed migration",
vm->def->name);
virDomainObjSetState(vm, VIR_DOMAIN_PAUSED,
VIR_DOMAIN_PAUSED_MIGRATION);
event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED);
ignore_value(virDomainObjSave(vm, driver->xmlopt, cfg->stateDir));
}
goto cleanup;
}
@ -1380,12 +1368,10 @@ libxlDomainMigrationSrcConfirm(libxlDriverPrivate *driver,
if (!vm->persistent || (flags & VIR_MIGRATE_UNDEFINE_SOURCE))
virDomainObjListRemove(driver->domains, vm);
ret = 0;
cleanup:
/* EndJob for corresponding BeginJob in begin phase */
virDomainObjEndJob(vm);
virObjectEventStateQueue(driver->domainEventState, event);
virObjectUnref(cfg);
return ret;
return 0;
}