File 0c710a37-libxl-resume-lock-on-mig-failure.patch of Package libvirt.8367

commit 0c710a37ea265dc7dfa0ebcebf1e21e4c6b2ea21
Author: Jim Fehlig <jfehlig@suse.com>
Date:   Wed Jan 24 14:23:04 2018 -0700

    libxl: resume lock process after failed migration
    
    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>

Index: libvirt-4.0.0/src/libxl/libxl_migration.c
===================================================================
--- libvirt-4.0.0.orig/src/libxl/libxl_migration.c
+++ libvirt-4.0.0/src/libxl/libxl_migration.c
@@ -1238,6 +1238,12 @@ libxlDomainMigrationPerform(libxlDriverP
     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(libxlDriverP
                             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 {