mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
lxc_container: Drop userns_supported
This is unnecessary wrapper around virProcessNamespaceAvailable(). Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
083fcd06d3
commit
cd32783cd4
@ -2262,11 +2262,6 @@ static int lxcContainerChild(void *data)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int userns_supported(void)
|
|
||||||
{
|
|
||||||
return virProcessNamespaceAvailable(VIR_PROCESS_NAMESPACE_USER) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int userns_required(virDomainDefPtr def)
|
static int userns_required(virDomainDefPtr def)
|
||||||
{
|
{
|
||||||
return def->idmap.uidmap && def->idmap.gidmap;
|
return def->idmap.uidmap && def->idmap.gidmap;
|
||||||
@ -2346,15 +2341,14 @@ int lxcContainerStart(virDomainDefPtr def,
|
|||||||
cflags = CLONE_NEWPID|CLONE_NEWNS|SIGCHLD;
|
cflags = CLONE_NEWPID|CLONE_NEWNS|SIGCHLD;
|
||||||
|
|
||||||
if (userns_required(def)) {
|
if (userns_required(def)) {
|
||||||
if (userns_supported()) {
|
if (virProcessNamespaceAvailable(VIR_PROCESS_NAMESPACE_USER) < 0) {
|
||||||
VIR_DEBUG("Enable user namespace");
|
|
||||||
cflags |= CLONE_NEWUSER;
|
|
||||||
} else {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("Kernel doesn't support user namespace"));
|
_("Kernel doesn't support user namespace"));
|
||||||
VIR_FREE(stack);
|
VIR_FREE(stack);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
VIR_DEBUG("Enable user namespace");
|
||||||
|
cflags |= CLONE_NEWUSER;
|
||||||
}
|
}
|
||||||
if (!nsInheritFDs || nsInheritFDs[VIR_LXC_DOMAIN_NAMESPACE_SHARENET] == -1) {
|
if (!nsInheritFDs || nsInheritFDs[VIR_LXC_DOMAIN_NAMESPACE_SHARENET] == -1) {
|
||||||
if (lxcNeedNetworkNamespace(def)) {
|
if (lxcNeedNetworkNamespace(def)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user