Checking link status according to DIB_DHCP_TIMEOUT

In slow networks like Infiniband it takes much time for the
interface to get the carrier. This patch enables this service
to run more then 20 seconds and limited by DIB_DHCP_TIMEOUT.

Change-Id: I8a6015567ac25e37b5a5aba4b1fda71170cc144a
This commit is contained in:
Lenny Verkhovsky 2017-12-24 12:57:56 +00:00
parent 2080055155
commit f249cec9f3
3 changed files with 4 additions and 3 deletions

View File

@ -25,5 +25,5 @@ DIB_DHCP_TIMEOUT
:Required: No
:Default: 30
:Description: Amount of time in seconds that the systemd service will
wait to get an address.
wait to get an address. Should be increased in networks such as Infiniband.
:Example: DIB_DHCP_TIMEOUT=300

View File

@ -11,6 +11,7 @@ SCRIPTDIR=$(dirname $0)
# this script is not needed on Gentoo.
if [ "$DISTRO_NAME" != "gentoo" ]; then
install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.sh /usr/local/sbin/dhcp-all-interfaces.sh
sed -i "s/DIB_DHCP_TIMEOUT/${DIB_DHCP_TIMEOUT:-30}/" /usr/local/sbin/dhcp-all-interfaces.sh
fi
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then

View File

@ -97,8 +97,8 @@ function inspect_interface() {
echo "Device has generated MAC, skipping."
else
local has_link
local tries
for ((tries = 0; tries < 20; tries++)); do
local tries=DIB_DHCP_TIMEOUT
for ((; tries > 0; tries--)); do
# Need to set the link up on each iteration
ip link set dev $interface up &>/dev/null
has_link=$(get_if_link $interface)