Merge "Checking link status according to DIB_DHCP_TIMEOUT"

This commit is contained in:
Zuul 2018-02-28 11:42:50 +00:00 committed by Gerrit Code Review
commit 05a44e2181
3 changed files with 4 additions and 3 deletions

View File

@ -25,5 +25,5 @@ DIB_DHCP_TIMEOUT
:Required: No :Required: No
:Default: 30 :Default: 30
:Description: Amount of time in seconds that the systemd service will :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 :Example: DIB_DHCP_TIMEOUT=300

View File

@ -11,6 +11,7 @@ SCRIPTDIR=$(dirname $0)
# this script is not needed on Gentoo. # this script is not needed on Gentoo.
if [ "$DISTRO_NAME" != "gentoo" ]; then 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 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 fi
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then

View File

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