render / rpms / libvirt

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