mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
lxc: remove no longer working netns check
Since iproute2 v6.12.0, the command "ip link set lo netns -1" can no longer be used to check for netns support, as it now validates PIDs are not less than zero. Since every kernel we care about has the support, just remove the check. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
This commit is contained in:
parent
dba710374d
commit
dd217cd938
@ -49,7 +49,6 @@ struct _virLXCDriverConfig {
|
|||||||
char *stateDir;
|
char *stateDir;
|
||||||
char *logDir;
|
char *logDir;
|
||||||
bool log_libvirtd;
|
bool log_libvirtd;
|
||||||
int have_netns;
|
|
||||||
|
|
||||||
char *securityDriverName;
|
char *securityDriverName;
|
||||||
bool securityDefaultConfined;
|
bool securityDefaultConfined;
|
||||||
|
@ -422,12 +422,6 @@ lxcDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags)
|
|||||||
if (virSecurityManagerVerify(driver->securityManager, def) < 0)
|
if (virSecurityManagerVerify(driver->securityManager, def) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((def->nets != NULL) && !(cfg->have_netns)) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
|
||||||
"%s", _("System lacks NETNS support"));
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(vm = virDomainObjListAdd(driver->domains, &def,
|
if (!(vm = virDomainObjListAdd(driver->domains, &def,
|
||||||
driver->xmlopt,
|
driver->xmlopt,
|
||||||
0, &oldDef)))
|
0, &oldDef)))
|
||||||
@ -974,12 +968,6 @@ static int lxcDomainCreateWithFiles(virDomainPtr dom,
|
|||||||
if (virDomainCreateWithFilesEnsureACL(dom->conn, vm->def) < 0)
|
if (virDomainCreateWithFilesEnsureACL(dom->conn, vm->def) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((vm->def->nets != NULL) && !(cfg->have_netns)) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
|
||||||
"%s", _("System lacks NETNS support"));
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0)
|
if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -1088,13 +1076,6 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn,
|
|||||||
if (virSecurityManagerVerify(driver->securityManager, def) < 0)
|
if (virSecurityManagerVerify(driver->securityManager, def) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((def->nets != NULL) && !(cfg->have_netns)) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
||||||
"%s", _("System lacks NETNS support"));
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!(vm = virDomainObjListAdd(driver->domains, &def,
|
if (!(vm = virDomainObjListAdd(driver->domains, &def,
|
||||||
driver->xmlopt,
|
driver->xmlopt,
|
||||||
VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
|
VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
|
||||||
@ -1386,22 +1367,6 @@ lxcDomainDestroy(virDomainPtr dom)
|
|||||||
return lxcDomainDestroyFlags(dom, 0);
|
return lxcDomainDestroyFlags(dom, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lxcCheckNetNsSupport(void)
|
|
||||||
{
|
|
||||||
g_autoptr(virCommand) cmd = virCommandNewArgList("ip", "link", "set", "lo",
|
|
||||||
"netns", "-1", NULL);
|
|
||||||
int ip_rc;
|
|
||||||
|
|
||||||
if (virCommandRun(cmd, &ip_rc) < 0 || ip_rc == 255)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (virProcessNamespaceAvailable(VIR_PROCESS_NAMESPACE_NET) < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static virSecurityManager *
|
static virSecurityManager *
|
||||||
lxcSecurityInit(virLXCDriverConfig *cfg)
|
lxcSecurityInit(virLXCDriverConfig *cfg)
|
||||||
{
|
{
|
||||||
@ -1481,7 +1446,6 @@ lxcStateInitialize(bool privileged,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
cfg->log_libvirtd = false; /* by default log to container logfile */
|
cfg->log_libvirtd = false; /* by default log to container logfile */
|
||||||
cfg->have_netns = lxcCheckNetNsSupport();
|
|
||||||
|
|
||||||
/* Call function to load lxc driver configuration information */
|
/* Call function to load lxc driver configuration information */
|
||||||
if (virLXCLoadDriverConfig(cfg, SYSCONFDIR "/libvirt/lxc.conf") < 0)
|
if (virLXCLoadDriverConfig(cfg, SYSCONFDIR "/libvirt/lxc.conf") < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user