From 9b4631ae0d0234b6b04e0f2aed0d7165e5ac2de2 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Mon, 22 Nov 2021 12:54:14 +1300 Subject: [PATCH] Use test_with_retry to get the tap device name This change replaces the 10 second sleep with a retry that has a timeout of 20 seconds to discover the name of the tap device. There are gate failures when there is still not a tap device after the 10 second sleep, so this approach should be faster in the common case, and the higher timeout should provide more reliability. Change-Id: I5e59ade9f830182b483b9655aaaf6c93b0bfac44 --- devstack/lib/ironic | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/devstack/lib/ironic b/devstack/lib/ironic index 18cd5535f2..c3302090b1 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -2028,12 +2028,10 @@ function create_ovs_taps { port_id=$(openstack --os-cloud $OS_CLOUD port create --network ${ironic_net_id} temp_port -c id -f value) die_if_not_set $LINENO port_id "Failed to create neutron port" - # intentional sleep to make sure the tag has been set to port - sleep 10 - local tapdev - tapdev=$(sudo ip netns exec qdhcp-${ironic_net_id} ip link list | grep " tap" | cut -d':' -f2 | cut -d'@' -f1 | cut -b2-) - die_if_not_set $LINENO tapdev "Failed to get tap device id" + local tapdev_cmd="sudo ip netns exec qdhcp-${ironic_net_id} ip link list | grep ' tap' | cut -d':' -f2 | cut -d'@' -f1 | cut -b2- | grep '^tap'" + # retry tap device discovery to make sure the tag has been set to port + tapdev=$(test_with_retry "$tapdev_cmd" "Failed to get tap device id" 20 1) local tag_id tag_id=$(sudo ovs-vsctl get port ${tapdev} tag) die_if_not_set $LINENO tag_id "Failed to get tag id"