From fc8538157ba39cffddf29c0ea6983896720c3089 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Wed, 3 Aug 2022 13:25:06 +0200 Subject: [PATCH] qemu: Do not try to set memlock on inactive domain When we call qemuDomainSetMaxMemLock to reset memory locking limit back to its original value the domain can already be stopped (for example after the domain shuts down during migration) in which case it does not make sense to set any limit. Doing so can even be harmful as we may end up setting the limit for the daemon itself as the PID is 0. Signed-off-by: Jiri Denemark Reviewed-by: Pavel Hrdina --- src/qemu/qemu_domain.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index dd8a295f0d..69e0c9e217 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9405,6 +9405,10 @@ qemuDomainSetMaxMemLock(virDomainObj *vm, { unsigned long long current = 0; + /* nothing to do if the domain is not running */ + if (vm->pid <= 0) + return 0; + if (virProcessGetMaxMemLock(vm->pid, ¤t) < 0) return -1; -- 2.47.3