Change in docker-playground[master]: gbproxy-fr: Wait for interface to be _up_ not just its existance

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Feb 4 09:37:51 UTC 2021


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/docker-playground/+/22674 )


Change subject: gbproxy-fr: Wait for interface to be _up_ not just its existance
......................................................................

gbproxy-fr: 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
---
M ttcn3-fr-test/docker-entrypoint.sh
1 file changed, 14 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/74/22674/1

diff --git a/ttcn3-fr-test/docker-entrypoint.sh b/ttcn3-fr-test/docker-entrypoint.sh
index 132c73c..1215f6a 100755
--- a/ttcn3-fr-test/docker-entrypoint.sh
+++ b/ttcn3-fr-test/docker-entrypoint.sh
@@ -5,7 +5,21 @@
 SUITE=$2
 
 if [[ -n ${WAIT_FOR_NETDEV:-} ]]; then
+	echo Waiting for ${WAIT_FOR_NETDEV} to appear
+	# this unfortunately only waits until the device exists
 	/usr/bin/pipework --wait -i ${WAIT_FOR_NETDEV}
+	# here we have to wait until it is up
+	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 && /osmo-ttcn3-hacks/start-testsuite.sh /osmo-ttcn3-hacks/$SUBDIR/$SUITE; \

-- 
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/22674
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I1bfb6eb925bca4e4e1901e06eed831152cddbbe2
Gerrit-Change-Number: 22674
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210204/c4bbaf21/attachment.htm>


More information about the gerrit-log mailing list