]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
lxc_container: Drop userns_supported
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 11 Jan 2017 09:45:44 +0000 (10:45 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 11 Jan 2017 17:05:03 +0000 (18:05 +0100)
This is unnecessary wrapper around virProcessNamespaceAvailable().

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

index e5619b16838f0cf343c008fc0a3be0c1b33315ff..601b9b03575c4456921fcbf58e3ce1cbd18f5609 100644 (file)
@@ -2262,11 +2262,6 @@ static int lxcContainerChild(void *data)
     return ret;
 }
 
-static int userns_supported(void)
-{
-    return virProcessNamespaceAvailable(VIR_PROCESS_NAMESPACE_USER) == 0;
-}
-
 static int userns_required(virDomainDefPtr def)
 {
     return def->idmap.uidmap && def->idmap.gidmap;
@@ -2346,15 +2341,14 @@ int lxcContainerStart(virDomainDefPtr def,
     cflags = CLONE_NEWPID|CLONE_NEWNS|SIGCHLD;
 
     if (userns_required(def)) {
-        if (userns_supported()) {
-            VIR_DEBUG("Enable user namespace");
-            cflags |= CLONE_NEWUSER;
-        } else {
+        if (virProcessNamespaceAvailable(VIR_PROCESS_NAMESPACE_USER) < 0) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("Kernel doesn't support user namespace"));
             VIR_FREE(stack);
             return -1;
         }
+        VIR_DEBUG("Enable user namespace");
+        cflags |= CLONE_NEWUSER;
     }
     if (!nsInheritFDs || nsInheritFDs[VIR_LXC_DOMAIN_NAMESPACE_SHARENET] == -1) {
         if (lxcNeedNetworkNamespace(def)) {