diff options
author | Lukas Nykryn <lnykryn@redhat.com> | 2014-04-02 17:29:09 +0200 |
---|---|---|
committer | Lukas Nykryn <lnykryn@redhat.com> | 2014-10-07 14:18:54 +0200 |
commit | 1cd862a337f4725c53f735f0d4e82a7d49774d9c (patch) | |
tree | 08fc665e3bf3f64896b72dd3aa493be02b9d9da3 | |
parent | 23eb694a61d155a0b5ce4403e1e0d8dc70653e76 (diff) | |
download | initscripts-1cd862a337f4725c53f735f0d4e82a7d49774d9c.tar initscripts-1cd862a337f4725c53f735f0d4e82a7d49774d9c.tar.gz initscripts-1cd862a337f4725c53f735f0d4e82a7d49774d9c.tar.bz2 initscripts-1cd862a337f4725c53f735f0d4e82a7d49774d9c.tar.xz initscripts-1cd862a337f4725c53f735f0d4e82a7d49774d9c.zip |
add configurable DEVTIMEOUT
-rwxr-xr-x | sysconfig/network-scripts/ifup | 2 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifup-eth | 2 | ||||
-rw-r--r-- | sysconfig/network-scripts/network-functions | 17 |
3 files changed, 19 insertions, 2 deletions
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index 1d5a9e63..f2a1c8f9 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -106,7 +106,7 @@ if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ] && [ -n $DEVICE ]; then fi fi - is_available ${PHYSDEV} || { + is_available_wait ${PHYSDEV} ${DEVTIMEOUT} || { if [ "$?" = "1" ] ; then net_log $"$alias device ${DEVICE} does not seem to be present, delaying initialization." exit 1 diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth index 51f21e82..c8154dc6 100755 --- a/sysconfig/network-scripts/ifup-eth +++ b/sysconfig/network-scripts/ifup-eth @@ -80,7 +80,7 @@ if [ -n "${TEAM_CONFIG}" ] && [ ! "${DEVICETYPE}" = "Team" ] && [ -x ./ifup-Team fi # now check the real state -is_available ${REALDEVICE} || { +is_available_wait ${REALDEVICE} ${DEVTIMEOUT} || { if [ -n "$alias" ]; then net_log $"$alias device ${DEVICE} does not seem to be present, delaying initialization." else diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 3b8d79d4..b9b35c0f 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -330,6 +330,23 @@ END { [ -d "/sys/class/net/$1" ] && return 0 || return 1 } +is_available_wait () +{ + [ -z "$1" ] && return 1 + + local retry=${2##*[!0-9]*} + + is_available $1 && return 0 + + while [ 0"$retry" -gt 0 ]; do + sleep 1 + [ -d "/sys/class/net/$1" ] && return 0 + retry=$(($retry -1)) + done + + return 1 +} + need_hostname () { CHECK_HOSTNAME=$(hostname) |