ironic-python-agent/imagebuild/tinyipa/build_files/dhcp.sh
Harald Jensås 7e3834be13 Raise udevadm settle timeout from 5 to 20 seconds
To fix for grenade slow discovery of e1000 network devices.

Ironic Inspector grenade job is using e1000 driver since
change: I4ec297281380896ffe9004c4de7117586ded7149

In some cases the e1000 devices has not registered yet,
and thus the dhcp init script does not find any interfaces
to bring up. This causes the grenade job to continue with
no networking, and the job finally fail.

Make the udev settle timout configurable (default 20 sec)
in finalise-tinyipa.sh.

Let's hope 20 seconds is enough. If not we now have more
logs to identify the issue.

Change-Id: I82beecc78afb4b23234d2d5eca4f46f84f20525e
2018-10-15 17:29:28 +02:00

22 lines
706 B
Bash

#!/bin/sh
# The DHCP portion is now separated out, in order to not slow the boot down
# only to wait for slow network cards
. /etc/init.d/tc-functions
# This waits until all devices have registered
/sbin/udevadm settle --timeout=%UDEV_SETTLE_TIMEOUT%
NETDEVICES="$(awk -F: '/eth.:|tr.:/{print $1}' /proc/net/dev 2>/dev/null)"
echo "$0: Discovered network devices: $NETDEVICES"
for DEVICE in $NETDEVICES; do
ifconfig $DEVICE | grep -q "inet addr"
if [ "$?" != 0 ]; then
echo -e "\nNetwork device $DEVICE detected, DHCP broadcasting for IP."
trap 2 3 11
/sbin/udhcpc -b -i $DEVICE -x hostname:$(/bin/hostname) -p /var/run/udhcpc.$DEVICE.pid 2>&1 &
trap "" 2 3 11
sleep 1
fi
done