From 8c4e60fcbf4fb81c333a9e2cff5fa00b1a4cb64f Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Thu, 25 Sep 2014 07:39:58 +0200 Subject: [PATCH] labs: simplify waiting for interfaces This patch simplifies the loops used to wait for the interfaces to appear. The names of the interfaces are now also written to the log file. Change-Id: I1356c3ff1731dbca87e1c5353d78428359fe96c3 --- labs/scripts/setup_neutron_network.sh | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/labs/scripts/setup_neutron_network.sh b/labs/scripts/setup_neutron_network.sh index 1f61585f..dff7ceea 100755 --- a/labs/scripts/setup_neutron_network.sh +++ b/labs/scripts/setup_neutron_network.sh @@ -174,24 +174,22 @@ until ip netns|grep qdhcp; do done nsdhcp=$(ip netns|grep qdhcp) -echo -n "Waiting for interfaces qr-*, qg-* in router namespace." -while [ : ]; do - ifaces=$(sudo ip netns exec "$nsrouter" ip addr) - if [[ $ifaces == *:\ qr-* && $ifaces == *:\ qg-* ]]; then - echo - break - fi + +echo -n "Waiting for interface qr-* in router namespace." +until sudo ip netns exec "$nsrouter" ip addr|grep -Po "(?<=: )qr-.*(?=:)"; do + echo -n "." + sleep 1 +done +nsdhcp=$(ip netns|grep qdhcp) + +echo -n "Waiting for interface qg-* in router namespace." +until sudo ip netns exec "$nsrouter" ip addr|grep -Po "(?<=: )qg-.*(?=:)"; do echo -n "." sleep 1 done echo -n "Waiting for interface tap* in DHCP namespace." -while [ : ]; do - ifaces=$(sudo ip netns exec "$nsdhcp" ip addr) - if [[ $ifaces == *:\ tap* ]]; then - echo - break - fi +until sudo ip netns exec "$nsdhcp" ip addr|grep -Po "(?<=: )tap.*(?=:)"; do echo -n "." sleep 1 done