From 48b1619318d34eae77b1bfb845c2165484d10971 Mon Sep 17 00:00:00 2001 From: Wen Liang Date: Wed, 6 Apr 2022 20:05:45 -0400 Subject: [PATCH] Validate the ip addresses added to the DHCP server DHCP server certainly needs the IP address configured in order to lease the address to the client. There is a bug in NM which wrongly removes all addresses on the unmanaged interface while it should not. To guarantee the IP address indeed configured for DHCP server, rescue it via adding conditional loop for configuring IP address to DHCP server. Notice that this workaround will be removed eventually when NM fixes the bug. https://bugzilla.redhat.com/show_bug.cgi?id=2079642 Signed-off-by: Wen Liang --- tests/tasks/create_test_interfaces_with_dhcp.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/tasks/create_test_interfaces_with_dhcp.yml b/tests/tasks/create_test_interfaces_with_dhcp.yml index 379bfbf..0ff326e 100644 --- a/tests/tasks/create_test_interfaces_with_dhcp.yml +++ b/tests/tasks/create_test_interfaces_with_dhcp.yml @@ -43,8 +43,17 @@ nmcli d set testbr managed false fi ip link set testbr up - ip addr add 192.0.2.1/24 dev testbr - ip -6 addr add 2001:DB8::1/32 dev testbr + timer=0 + # The while loop following is a workaround for the NM bug, which can be + # tracked in https://bugzilla.redhat.com/show_bug.cgi?id=2079642 + while ! ip addr show testbr | grep -q 'inet [1-9]' + do + let "timer+=1" + if [ $timer -eq 30 ]; then break; fi + sleep 1 + ip addr add 192.0.2.1/24 dev testbr + ip -6 addr add 2001:DB8::1/32 dev testbr + done if grep 'release 6' /etc/redhat-release; then # We need bridge-utils and radvd only in rhel6