4372d3
From 8354fa1d2e471699331961272bc38f5e4cfe7cb8 Mon Sep 17 00:00:00 2001
4372d3
Message-Id: <8354fa1d2e471699331961272bc38f5e4cfe7cb8@dist-git>
11fcb6
From: Jiri Denemark <jdenemar@redhat.com>
11fcb6
Date: Wed, 22 Jun 2022 09:04:04 +0200
11fcb6
Subject: [PATCH] qemu_migration: Use qemuDomainSetMaxMemLock
11fcb6
MIME-Version: 1.0
11fcb6
Content-Type: text/plain; charset=UTF-8
11fcb6
Content-Transfer-Encoding: 8bit
11fcb6
11fcb6
This helper will not try to set the limit if it is already big enough,
11fcb6
which may be useful when libvirt daemon is running in a containerized
11fcb6
environment and is not allowed to change memory locking limit.
11fcb6
11fcb6
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
11fcb6
Reviewed-by: Ján Tomko <jtomko@redhat.com>
11fcb6
(cherry picked from commit 22ee8cbf090c45f999b76e3f8dc7a45065fc9edf)
11fcb6
4372d3
https://bugzilla.redhat.com/show_bug.cgi?id=2089433
11fcb6
11fcb6
Conflicts:
11fcb6
	src/qemu/qemu_migration.c
11fcb6
            - refactoring for post-copy recovery not backported
11fcb6
11fcb6
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
11fcb6
---
11fcb6
 src/qemu/qemu_migration.c | 4 ++--
11fcb6
 1 file changed, 2 insertions(+), 2 deletions(-)
11fcb6
11fcb6
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
11fcb6
index 2635ef1162..10338f8e87 100644
11fcb6
--- a/src/qemu/qemu_migration.c
11fcb6
+++ b/src/qemu/qemu_migration.c
11fcb6
@@ -2974,7 +2974,7 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver,
11fcb6
 
11fcb6
     if (STREQ_NULLABLE(protocol, "rdma") &&
11fcb6
         vm->def->mem.hard_limit > 0 &&
11fcb6
-        virProcessSetMaxMemLock(vm->pid, vm->def->mem.hard_limit << 10) < 0) {
11fcb6
+        qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10, NULL) < 0) {
11fcb6
         goto stopjob;
11fcb6
     }
11fcb6
 
11fcb6
@@ -4224,7 +4224,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
11fcb6
     case MIGRATION_DEST_HOST:
11fcb6
         if (STREQ(spec->dest.host.protocol, "rdma") &&
11fcb6
             vm->def->mem.hard_limit > 0 &&
11fcb6
-            virProcessSetMaxMemLock(vm->pid, vm->def->mem.hard_limit << 10) < 0) {
11fcb6
+            qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10, NULL) < 0) {
11fcb6
             goto exit_monitor;
11fcb6
         }
11fcb6
         rc = qemuMonitorMigrateToHost(priv->mon, migrate_flags,
11fcb6
-- 
11fcb6
2.35.1
11fcb6