summaryrefslogtreecommitdiff
path: root/devstack/lib/ironic
diff options
context:
space:
mode:
authorSteve Baker <sbaker@redhat.com>2021-11-22 12:54:14 +1300
committerSteve Baker <sbaker@redhat.com>2021-11-22 13:50:59 +1300
commit9b4631ae0d0234b6b04e0f2aed0d7165e5ac2de2 (patch)
treefc13296be6a438307da39175a6cc06e1cc1b39dd /devstack/lib/ironic
parentf90b5a6c11d6db53a65d85807959b8ab9b97c602 (diff)
downloadironic-9b4631ae0d0234b6b04e0f2aed0d7165e5ac2de2.tar.gz
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
Diffstat (limited to 'devstack/lib/ironic')
-rw-r--r--devstack/lib/ironic8
1 files changed, 3 insertions, 5 deletions
diff --git a/devstack/lib/ironic b/devstack/lib/ironic
index 18cd5535f..c3302090b 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"