To check nonlocal_bind option for already created namespaces

Change-Id: Ic92b194445882b364564ff0139e2e2dcff9287d4
Closes-bug: 1632320
This commit is contained in:
Viacheslav Valyavskiy 2016-10-11 15:35:56 +03:00
parent 800aae5515
commit dfbb81604d
1 changed files with 3 additions and 0 deletions

View File

@ -292,6 +292,9 @@ check_ns() {
local ns=$(ip netns list | awk "/${OCF_RESKEY_ns}/ {print \$1}")
ocf_log debug "${LH} recieved netns list: ${ns}"
[ "${ns}" != "${OCF_RESKEY_ns}" ] && return $OCF_ERR_GENERIC
if [ "`$RUN_IN_NS /sbin/sysctl net.ipv4.ip_nonlocal_bind --values`" -eq "0" ]; then
ocf_run $RUN_IN_NS /sbin/sysctl -w net.ipv4.ip_nonlocal_bind=1
fi
return $OCF_SUCCESS
}