]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuProcessStartPRDaemonHook: Try to set NS iff domain was started with one
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 3 Jul 2018 11:19:59 +0000 (13:19 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 10 Jul 2018 12:56:22 +0000 (14:56 +0200)
Users have possibility to disable qemu namespace feature (e.g.
because they are running on *BSD which lacks Linux NS support).
If that's the case we should not try to move qemu-pr-helper into
the same namespace as qemu is in.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_process.c

index 40d35cbe6b6bd012b12668923e4e2724894d203f..f200729cb145ba7e3af81d276ba91c39d872d6f4 100644 (file)
@@ -2522,12 +2522,14 @@ qemuProcessStartPRDaemonHook(void *opaque)
     int *fds = NULL;
     int ret = -1;
 
-    if (virProcessGetNamespaces(vm->pid, &nfds, &fds) < 0)
-        return ret;
+    if (qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) {
+        if (virProcessGetNamespaces(vm->pid, &nfds, &fds) < 0)
+            return ret;
 
-    if (nfds > 0 &&
-        virProcessSetNamespaces(nfds, fds) < 0)
-        goto cleanup;
+        if (nfds > 0 &&
+            virProcessSetNamespaces(nfds, fds) < 0)
+            goto cleanup;
+    }
 
     ret = 0;
  cleanup: