459f93
From b6c1f9ca8eb0ca8f7603ab205c7dc95b9f07b5a0 Mon Sep 17 00:00:00 2001
459f93
Message-Id: <b6c1f9ca8eb0ca8f7603ab205c7dc95b9f07b5a0@dist-git>
459f93
From: Jiri Denemark <jdenemar@redhat.com>
459f93
Date: Mon, 18 Jul 2022 16:01:20 +0200
459f93
Subject: [PATCH] RHEL: qemu_migration: Fix restoring memlock limit on
459f93
 destination
459f93
459f93
Restoring memory locking limit on the destination host only makes sense
459f93
when migration succeeded as otherwise the QEMU process will be killed
459f93
anyway. Specifically if the migration fails because the process died,
459f93
touching the limit would produce rather unhelpful error message instead
459f93
of the real issue:
459f93
459f93
    cannot get locked memory limit of process -1: No such file or
459f93
    directory
459f93
459f93
This patch is RHEL-only caused by misplacing the call to
459f93
qemuDomainSetMaxMemLock when the "qemu_migration: Restore original
459f93
memory locking limit" upstream patch was backported to an older code
459f93
base.
459f93
459f93
https://bugzilla.redhat.com/show_bug.cgi?id=2107954
459f93
459f93
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
459f93
---
459f93
 src/qemu/qemu_migration.c | 3 ++-
459f93
 1 file changed, 2 insertions(+), 1 deletion(-)
459f93
459f93
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
459f93
index db5163e993..11f87296d6 100644
459f93
--- a/src/qemu/qemu_migration.c
459f93
+++ b/src/qemu/qemu_migration.c
459f93
@@ -5895,6 +5895,8 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
459f93
          */
459f93
         if (inPostCopy)
459f93
             g_clear_pointer(&priv->job.completed, qemuDomainJobInfoFree);
459f93
+
459f93
+        qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock);
459f93
     }
459f93
 
459f93
     qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_MIGRATION_IN,
459f93
@@ -5907,7 +5909,6 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
459f93
  cleanup:
459f93
     g_clear_pointer(&jobInfo, qemuDomainJobInfoFree);
459f93
     virPortAllocatorRelease(port);
459f93
-    qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock);
459f93
     if (priv->mon)
459f93
         qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL);
459f93
     VIR_FREE(priv->origname);
459f93
-- 
459f93
2.35.1
459f93