Fix ifup not adding the default gw for IPv4
When restoring an IPv4 subcloud (BnR), the ansible task "Bring up original networking" was failing to restore the default gateway causing k8s apps to fail because the API address was not reachable. This bug was introduced after a patch for checking for existing address was added for the ifup tool in https://review.opendev.org/c/starlingx/integ/+/952277 The patch made ifup stop adding the default gateway for IPv4 addresses in case the address is already created. This fix makes sure the default gateway is added by ifup when using a static IPv4 address with a gateway in the interface configuration file (/etc/network/interface.d). Test plan: [PASS] Manual 'ifup -v' and 'ip route' checks [PASS] Fresh controller and subcloud installation [PASS] BnR IPv4 subcloud using different system-controller-oam and oam subnets [PASS] Subcloud enrollment Closes-Bug: 2125502 Change-Id: I4d39340943d18a3640fccefe31e17f66484ff8f6 Signed-off-by: Caio Bruchert <caio.bruchert@windriver.com>
This commit is contained in:
@@ -145,9 +145,9 @@ index f6f3795..a79215c 100644
|
||||
-
|
||||
- [[ /sbin/ip route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]]
|
||||
+ [[peer %pointopoint%]] [[scope %scope%]] dev %iface% label %iface% ; \
|
||||
+ /sbin/ip link set dev %iface% [[mtu %mtu%]] [[address %hwaddress%]] up ; \
|
||||
+ [[ /sbin/ip route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]] \
|
||||
+ if (!address_exists())
|
||||
+ /sbin/ip link set dev %iface% [[mtu %mtu%]] [[address %hwaddress%]] up ;
|
||||
+ [[ /sbin/ip route replace default via %gateway% [[metric %metric%]] dev %iface% onlink ]]
|
||||
|
||||
down
|
||||
[[ /sbin/ip route del default via %gateway% [[metric %metric%]] dev %iface% 2>&1 1>/dev/null || true ]]
|
||||
|
Reference in New Issue
Block a user