debian-stretch-titan: Wait for interface to be _up_ not just its existance

I've seen at least one instance where -EIFDOWN was returned when the
test suite was coming up.  This is a race condition, as we first
have to move the netdev into the namespace and only then can configure
it.  "pipework wait" only waits for its existence, not until it is up.

We cannot revert the order, as the netdev looses its state when it
is moved to a different netns.

Change-Id: I1bfb6eb925bca4e4e1901e06eed831152cddbbe2
This commit is contained in:
Harald Welte 2021-02-03 22:05:43 +01:00 committed by Daniel Willmann
parent ac920b7716
commit d2014603a7
1 changed files with 13 additions and 0 deletions

View File

@ -14,7 +14,20 @@ SUBDIR=$1
SUITE=$2
if [ -n "$WAIT_FOR_NETDEV" ]; then
echo "Waiting for ${WAIT_FOR_NETDEV} to appear"
pipework --wait -i "$WAIT_FOR_NETDEV"
while true; do
if [ ! -f /sys/class/net/${WAIT_FOR_NETDEV}/operstate ]; then
exit 23
fi
OPSTATE=$(cat /sys/class/net/${WAIT_FOR_NETDEV}/operstate)
if [ "$OPSTATE" = "up" ]; then
break
fi
echo "Waiting for ${WAIT_FOR_NETDEV} to become operational"
sleep 1
done
fi
cd /data