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

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