Set ip_forward in vrouter namespace to 1 each monitor

For some reason we can have ip_forward reset sometimes
in the vrouter namespace, which leads to connectivity tests
issues. In order to fix this we move ip_forward setting
to get_ns() function to monitor and set it each monitor operation

Change-Id: I2d10d465259adc1f30161fee488feef4179b5c70
Related-bug: #1654967
This commit is contained in:
Vladimir Kuklin 2017-01-11 16:39:16 +03:00
parent 4f691b399f
commit 066c7e5de9
1 changed files with 2 additions and 2 deletions

View File

@ -187,6 +187,7 @@ 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
ocf_run $RUN_IN_NS sysctl -w net.ipv4.ip_forward=1
return $OCF_SUCCESS
}
@ -198,6 +199,7 @@ get_ns() {
ocf_run ip netns add $OCF_RESKEY_ns
rc=$?
ocf_run $RUN_IN_NS /sbin/sysctl -w net.ipv4.ip_nonlocal_bind=1
ocf_run $RUN_IN_NS sysctl -w net.ipv4.ip_forward=1
ocf_run $RUN_IN_NS ip link set up dev lo
ocf_log debug "${LH} added netns ${OCF_RESKEY_ns} and set up lo"
@ -209,8 +211,6 @@ set_ns_routing() {
ip netns exec "${OCF_RESKEY_ns}" ip ${@}
}
ocf_run $RUN_IN_NS sysctl -w net.ipv4.ip_forward=1
# create host-ns veth pair unless it's present
ip link | grep -q '^[[:digit:]]\+:[[:space:]]\+'"${OCF_RESKEY_host_interface}"'[@:]'
if [ $? -gt 0 ]; then