Change in docker-playground[master]: debian-stretch-titan: Wait for interface to be _up_ not just its exis...

daniel gerrit-no-reply at lists.osmocom.org
Wed Jul 28 13:44:21 UTC 2021


daniel has submitted this change. ( https://gerrit.osmocom.org/c/docker-playground/+/22674 )

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

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
---
M debian-stretch-titan/ttcn3-docker-run.sh
1 file changed, 13 insertions(+), 0 deletions(-)

Approvals:
  daniel: Verified
  osmith: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



diff --git a/debian-stretch-titan/ttcn3-docker-run.sh b/debian-stretch-titan/ttcn3-docker-run.sh
index da3d314..c868220 100755
--- a/debian-stretch-titan/ttcn3-docker-run.sh
+++ b/debian-stretch-titan/ttcn3-docker-run.sh
@@ -14,7 +14,20 @@
 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

-- 
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: 5
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Assignee: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210728/0915d9f0/attachment.htm>


More information about the gerrit-log mailing list