summaryrefslogtreecommitdiff
path: root/imagebuild
diff options
context:
space:
mode:
authorHarald Jensås <hjensas@redhat.com>2018-10-11 19:13:54 +0200
committerHarald Jensås <hjensas@redhat.com>2018-10-15 17:29:28 +0200
commit7e3834be13b32afef34bd118ce3f1640d1dd72f7 (patch)
treeb58d25269c25e0cd1be5c21da5fe5ffb314f072e /imagebuild
parent855863fdc32063e6754e0498477801ded91ec332 (diff)
downloadironic-python-agent-7e3834be13b32afef34bd118ce3f1640d1dd72f7.tar.gz
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
Diffstat (limited to 'imagebuild')
-rw-r--r--imagebuild/tinyipa/build_files/dhcp.sh21
-rwxr-xr-ximagebuild/tinyipa/finalise-tinyipa.sh5
2 files changed, 26 insertions, 0 deletions
diff --git a/imagebuild/tinyipa/build_files/dhcp.sh b/imagebuild/tinyipa/build_files/dhcp.sh
new file mode 100644
index 00000000..8383f262
--- /dev/null
+++ b/imagebuild/tinyipa/build_files/dhcp.sh
@@ -0,0 +1,21 @@
+#!/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
+
diff --git a/imagebuild/tinyipa/finalise-tinyipa.sh b/imagebuild/tinyipa/finalise-tinyipa.sh
index ed24ba4b..df8e0c0e 100755
--- a/imagebuild/tinyipa/finalise-tinyipa.sh
+++ b/imagebuild/tinyipa/finalise-tinyipa.sh
@@ -23,6 +23,7 @@ SSH_PUBLIC_KEY=${SSH_PUBLIC_KEY:-}
PYOPTIMIZE_TINYIPA=${PYOPTIMIZE_TINYIPA:-true}
TINYIPA_REQUIRE_BIOSDEVNAME=${TINYIPA_REQUIRE_BIOSDEVNAME:-false}
TINYIPA_REQUIRE_IPMITOOL=${TINYIPA_REQUIRE_IPMITOOL:-true}
+TINYIPA_UDEV_SETTLE_TIMEOUT=${TINYIPA_UDEV_SETTLE_TIMEOUT:-20}
echo "Finalising tinyipa:"
@@ -147,6 +148,10 @@ sudo cp "$WORKDIR/build_files/bootlocal.sh" "$FINALDIR/opt/."
# Copy udhcpc.script to opt
sudo cp "$WORKDIR/udhcpc.script" "$FINALDIR/opt/"
+# Replace etc/init.d/dhcp.sh
+sudo cp "$WORKDIR/build_files/dhcp.sh" "$FINALDIR/etc/init.d/dhcp.sh"
+sudo sed -i "s/%UDEV_SETTLE_TIMEOUT%/$TINYIPA_UDEV_SETTLE_TIMEOUT/" "$FINALDIR/etc/init.d/dhcp.sh"
+
# Disable ZSwap
sudo sed -i '/# Main/a NOZSWAP=1' "$FINALDIR/etc/init.d/tc-config"
# sudo cp $WORKDIR/build_files/tc-config $FINALDIR/etc/init.d/tc-config