render / rpms / libvirt

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