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 <jfeh...@suse.com>
---
 src/libxl/libxl_migration.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 961815f9f7..a91091f5e8 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -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;
 }
-- 
2.41.0

Reply via email to