]> xenbits.xensource.com Git - libvirt.git/commitdiff
libxl: resume lock process after failed migration
authorJim Fehlig <jfehlig@suse.com>
Wed, 24 Jan 2018 21:23:04 +0000 (14:23 -0700)
committerJim Fehlig <jfehlig@suse.com>
Thu, 25 Jan 2018 16:22:14 +0000 (09:22 -0700)
During migration, the lock process is paused in the perform phase
but not resumed if there is a subsequent failure, leaving the locked
resource unprotected.

The perform phase itself can fail, in which case the lock process
should be resumed before returning from perform. The finish phase
could also fail on the destination host, in which case the migration
is canceled in the confirm phase and the VM is resumed. The lock
process needs to be resumed there as well.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
src/libxl/libxl_migration.c

index 228c8508c437946394236582b0fc8280c7ca5e40..a7a578c7292d943f20f7c9eb85b3d8b7d292cff1 100644 (file)
@@ -1238,6 +1238,12 @@ libxlDomainMigrationPerform(libxlDriverPrivatePtr driver,
     ret = libxlDoMigrateSend(driver, vm, flags, sockfd);
     virObjectLock(vm);
 
+    if (ret < 0)
+        virDomainLockProcessResume(driver->lockManager,
+                                   "xen:///system",
+                                   vm,
+                                   priv->lockState);
+
  cleanup:
     VIR_FORCE_CLOSE(sockfd);
     virURIFree(uri);
@@ -1349,10 +1355,16 @@ libxlDomainMigrationConfirm(libxlDriverPrivatePtr driver,
                             int cancelled)
 {
     libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+    libxlDomainObjPrivatePtr priv = vm->privateData;
     virObjectEventPtr event = NULL;
     int ret = -1;
 
     if (cancelled) {
+        /* Resume lock process that was paused in MigrationPerform */
+        virDomainLockProcessResume(driver->lockManager,
+                                   "xen:///system",
+                                   vm,
+                                   priv->lockState);
         if (libxl_domain_resume(cfg->ctx, vm->def->id, 1, 0) == 0) {
             ret = 0;
         } else {