[libvirt] [PATCH] libxl: resume lock process after failed migration

Jim Fehlig posted 1 patch 6 years, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180124214346.9303-1-jfehlig@suse.com
src/libxl/libxl_migration.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
[libvirt] [PATCH] libxl: resume lock process after failed migration
Posted by Jim Fehlig 6 years, 2 months ago
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 | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 228c8508c..a7a578c72 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -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 {
-- 
2.16.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] libxl: resume lock process after failed migration
Posted by Michal Privoznik 6 years, 2 months ago
On 01/24/2018 10:43 PM, Jim Fehlig wrote:
> 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 | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

ACK

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list