Blame SOURCES/libvirt-qemuProcessStartPRDaemonHook-Try-to-set-NS-iff-domain-was-started-with-one.patch

51d9a2
From 42cd53447f05f85976b42da5c0030be4a94fd72f Mon Sep 17 00:00:00 2001
51d9a2
Message-Id: <42cd53447f05f85976b42da5c0030be4a94fd72f@dist-git>
51d9a2
From: Michal Privoznik <mprivozn@redhat.com>
51d9a2
Date: Wed, 11 Jul 2018 17:27:23 +0200
51d9a2
Subject: [PATCH] qemuProcessStartPRDaemonHook: Try to set NS iff domain was
51d9a2
 started with one
51d9a2
MIME-Version: 1.0
51d9a2
Content-Type: text/plain; charset=UTF-8
51d9a2
Content-Transfer-Encoding: 8bit
51d9a2
51d9a2
https://bugzilla.redhat.com/show_bug.cgi?id=1470007
51d9a2
51d9a2
Users have possibility to disable qemu namespace feature (e.g.
51d9a2
because they are running on *BSD which lacks Linux NS support).
51d9a2
If that's the case we should not try to move qemu-pr-helper into
51d9a2
the same namespace as qemu is in.
51d9a2
51d9a2
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
51d9a2
(cherry picked from commit dd1d58cabc850324bb9a7ed836985d34697aa7b2)
51d9a2
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
51d9a2
Reviewed-by: Ján Tomko <jtomko@redhat.com>
51d9a2
---
51d9a2
 src/qemu/qemu_process.c | 12 +++++++-----
51d9a2
 1 file changed, 7 insertions(+), 5 deletions(-)
51d9a2
51d9a2
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
51d9a2
index 40d35cbe6b..f200729cb1 100644
51d9a2
--- a/src/qemu/qemu_process.c
51d9a2
+++ b/src/qemu/qemu_process.c
51d9a2
@@ -2522,12 +2522,14 @@ qemuProcessStartPRDaemonHook(void *opaque)
51d9a2
     int *fds = NULL;
51d9a2
     int ret = -1;
51d9a2
 
51d9a2
-    if (virProcessGetNamespaces(vm->pid, &nfds, &fds) < 0)
51d9a2
-        return ret;
51d9a2
+    if (qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) {
51d9a2
+        if (virProcessGetNamespaces(vm->pid, &nfds, &fds) < 0)
51d9a2
+            return ret;
51d9a2
 
51d9a2
-    if (nfds > 0 &&
51d9a2
-        virProcessSetNamespaces(nfds, fds) < 0)
51d9a2
-        goto cleanup;
51d9a2
+        if (nfds > 0 &&
51d9a2
+            virProcessSetNamespaces(nfds, fds) < 0)
51d9a2
+            goto cleanup;
51d9a2
+    }
51d9a2
 
51d9a2
     ret = 0;
51d9a2
  cleanup:
51d9a2
-- 
51d9a2
2.18.0
51d9a2