render / rpms / libvirt

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