render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
38f2fd
From 81421950fe905de097d4ac49f932a902937fb01b Mon Sep 17 00:00:00 2001
38f2fd
Message-Id: <81421950fe905de097d4ac49f932a902937fb01b@dist-git>
38f2fd
From: Peter Krempa <pkrempa@redhat.com>
38f2fd
Date: Fri, 20 Nov 2015 13:29:10 +0100
38f2fd
Subject: [PATCH] qemu: hotplug: Reject VFIO hotplug if setting RLIMIT_MEMLOCK
38f2fd
 fails
38f2fd
38f2fd
Check the return value of virCommandSetMaxMemLock when hotplugging VFIO
38f2fd
PCI hostdevs and reject the hotplug if the memory limit can't be set.
38f2fd
38f2fd
(cherry picked from commit baf55e1fa41a6aa77a5373891d70947ef24acadd)
38f2fd
38f2fd
The code touched by this commit is removed in a later commit,
38f2fd
but including this in the backport gets rid of conflicts when
38f2fd
doing so.
38f2fd
38f2fd
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1283924
38f2fd
38f2fd
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
38f2fd
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
38f2fd
---
38f2fd
 src/qemu/qemu_hotplug.c | 5 ++++-
38f2fd
 1 file changed, 4 insertions(+), 1 deletion(-)
38f2fd
38f2fd
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
38f2fd
index 70aece4..785423a 100644
38f2fd
--- a/src/qemu/qemu_hotplug.c
38f2fd
+++ b/src/qemu/qemu_hotplug.c
38f2fd
@@ -1279,7 +1279,10 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
38f2fd
         }
38f2fd
 
38f2fd
         /* setup memory locking limits, that are necessary for VFIO */
38f2fd
-        virProcessSetMaxMemLock(vm->pid, qemuDomainGetMlockLimitBytes(vm->def));
38f2fd
+        if (virProcessSetMaxMemLock(vm->pid,
38f2fd
+                                    qemuDomainGetMlockLimitBytes(vm->def)) < 0)
38f2fd
+            goto error;
38f2fd
+
38f2fd
         break;
38f2fd
 
38f2fd
     default:
38f2fd
-- 
38f2fd
2.6.3
38f2fd