Skip to content

Commit 5e16f58

Browse files
cybertronopenshift-cherrypick-robot
authored andcommitted
Use ip command to check for ipv4/v6 addresses
For some reason the nmcli call to determine the number of ipv6 addresses on an interface is sometimes returning a blank line as part of the output. This causes a single address to look like 2 because we're just checking the line count and makes us incorrectly set "ipv6.may-fail no" on the interface. This causes the connection to fail and prevents ovs-configuration from completing. Here's some example output from an affected system: [root@master-0-0 core]# nmcli -m multiline --get-values ip6.address conn show 84a523ff-ee8a-4a29-94ca-47590eb0cb76 IP6.ADDRESS[1]:fe80::5054:ff:fe6e:6923/64 [root@master-0-0 core]# Additionally, we have seen another case where the link-local address from both the baremetal and provisioning networks shows up in the output of this command. That will also fail because we're just looking for line count > 1. This change modifies the check to use the ip command on the interface directly, so we should only get the addresses on the interface itself and we can use jq to filter out the ones we're not interested in. Although the bug specifically related to ipv6 addresses, in theory a similar issue could exist for ipv4 so that check is also converted.
1 parent 1307ccf commit 5e16f58

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

templates/common/_base/files/configure-ovs-network.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,15 @@ contents:
308308
else
309309
extra_if_brex_args=""
310310
# check if interface had ipv4/ipv6 addresses assigned
311-
ipv4_addr=$(nmcli --get-values ip4.address conn show ${old_conn})
312-
if [ -n "$ipv4_addr" ]; then
311+
num_ipv4_addrs=$(ip -j a show dev ${iface} | jq ".[0].addr_info | map(. | select(.family == \"inet\")) | length")
312+
if [ "$num_ipv4_addrs" -gt 0 ]; then
313313
extra_if_brex_args+="ipv4.may-fail no "
314314
fi
315315
316316
# IPV6 should have at least a link local address. Check for more than 1 to see if there is an
317317
# assigned address.
318-
num_ip6_addrs=$(nmcli -m multiline --get-values ip6.address conn show ${old_conn} | wc -l)
319-
if [ "$num_ip6_addrs" -gt 1 ]; then
318+
num_ip6_addrs=$(ip -j a show dev ${iface} | jq ".[0].addr_info | map(. | select(.family == \"inet6\" and .scope != \"link\")) | length")
319+
if [ "$num_ip6_addrs" -gt 0 ]; then
320320
extra_if_brex_args+="ipv6.may-fail no "
321321
fi
322322

0 commit comments

Comments
 (0)