From 097bf969d418c5e6bdf9e2bf412ad9dfac6cc0e8 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Tue, 12 May 2020 13:22:06 +0200 Subject: [PATCH] Configure bond IP even if there is a $next_nic but also $_ipaddr Check for $_ipaddr instead of $next_nic. The followint configuration is totally valid but fails with the old logic because it does not configure any bond0 IP because $next_nic is set to bond0.10. nictypes.eno1=Ethernet nictypes.eno2=Ethernet nicdevices.bond0=eno1|eno2 nictypes.bond0=bond nicnetworks.bond0=management nicips.bond0=192.168.0.1 nicdevices.bond0.10=bond0 nictypes.bond0.10=vlan nicnetworks.bond0.10=production nicips.bond0.10=192.168.1.1 May needs some additional testing with bridges etc. --- xCAT/postscripts/nicutils.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT/postscripts/nicutils.sh b/xCAT/postscripts/nicutils.sh index d142cc663..f00407d02 100755 --- a/xCAT/postscripts/nicutils.sh +++ b/xCAT/postscripts/nicutils.sh @@ -2135,7 +2135,7 @@ function create_bond_interface_nmcli { else _bonding_opts="mode=active-backup" fi - if [ -z "$next_nic" ]; then + if [ -n "$_ipaddr" ]; then # query "nicnetworks" table about its target "xcatnet" xcatnet=$(query_nicnetworks_net $bondname) log_info "Pickup xcatnet, \"$xcatnet\", from NICNETWORKS for interface \"$bondname\"." @@ -2198,7 +2198,7 @@ function create_bond_interface_nmcli { # create raw bond device log_info "create bond connection $xcat_con_name" cmd="" - if [ -n "$next_nic" ]; then + if [ -z "$_ipaddr" ]; then cmd="$nmcli con add type bond con-name $xcat_con_name ifname $bondname bond.options $_bonding_opts ipv4.method disabled ipv6.method ignore autoconnect yes connection.autoconnect-priority 9 connection.autoconnect-slaves 1 connection.autoconnect-retries 0" else cmd="$nmcli con add type bond con-name $xcat_con_name ifname $bondname bond.options $_bonding_opts method none ipv4.method manual ipv4.addresses $ipv4_addr/$str_prefix $_mtu connection.autoconnect-priority 9 connection.autoconnect-slaves 1 connection.autoconnect-retries 0" @@ -2286,7 +2286,7 @@ function create_bond_interface_nmcli { # bring up interface formally log_info "$nmcli con up $xcat_con_name" $nmcli con up $xcat_con_name - if [ -z "$next_nic" ]; then + if [ -n "$_ipaddr" ]; then is_connection_activate_intime $xcat_con_name is_active=$? if [ "$is_active" -eq 0 ]; then