Blame SOURCES/libvirt-RHEL-qemu_migration-Fix-restoring-memlock-limit-on-destination.patch

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