mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-07-03 03:15:33 +00:00
Adjustments to configib to handle Rocky9 precreated connections (#7490)
* take out useless arp_ignore/arp_filter lines * create logic to use con add if con doesn't exist, else con modify * swap the con modify vs con add logic so that it matches the test logic * add back arp_filter and arp_ignore --------- Co-authored-by: dmarm <dmarm@dmarms-MBP.lan>
This commit is contained in:
@ -486,13 +486,25 @@ IPADDR_$ipindex=$nicip" >> $dir/ifcfg-$nic
|
||||
if [ $ipindex -eq 1 ]
|
||||
then
|
||||
if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then
|
||||
# ipv6
|
||||
if echo $nicip | grep : 2>&1 1>/dev/null
|
||||
then
|
||||
nmcli con add type infiniband con-name $nic ifname $nic ipv6.method manual ipv6.addresses $nicip
|
||||
else # ipv4
|
||||
prefix=$(convert_netmask_to_cidr $netmask)
|
||||
nmcli con add type infiniband con-name $nic ifname $nic ipv4.method manual ipv4.addresses $nicip/$prefix
|
||||
if nmcli --field connection.id con show $nic 2>&1 1>/dev/null
|
||||
then # modify current connection
|
||||
# ipv6
|
||||
if echo $nicip | grep : 2>&1 1>/dev/null
|
||||
then
|
||||
nmcli con modify $nic type infiniband con-name $nic ifname $nic ipv6.method manual ipv6.addresses $nicip
|
||||
else # ipv4
|
||||
prefix=$(convert_netmask_to_cidr $netmask)
|
||||
nmcli con modify $nic type infiniband con-name $nic ifname $nic ipv4.method manual ipv4.addresses $nicip/$prefix
|
||||
fi
|
||||
else # create new connection
|
||||
# ipv6
|
||||
if echo $nicip | grep : 2>&1 1>/dev/null
|
||||
then
|
||||
nmcli con add type infiniband con-name $nic ifname $nic ipv6.method manual ipv6.addresses $nicip
|
||||
else # ipv4
|
||||
prefix=$(convert_netmask_to_cidr $netmask)
|
||||
nmcli con add type infiniband con-name $nic ifname $nic ipv4.method manual ipv4.addresses $nicip/$prefix
|
||||
fi
|
||||
fi
|
||||
else
|
||||
nmcontrol=""
|
||||
@ -540,7 +552,7 @@ IPADDR=$nicip" > $dir/ifcfg-$nic
|
||||
value="${array_extra_param_values[$i]}"
|
||||
echo " $i: name=$name value=$value"
|
||||
if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then
|
||||
nmcli con modify $con_name $name $value
|
||||
nmcli con modify $nic $name $value
|
||||
else
|
||||
grep -i "${name}" $dir/ifcfg-$nic
|
||||
if [ $? -eq 0 ];then
|
||||
@ -553,13 +565,25 @@ IPADDR=$nicip" > $dir/ifcfg-$nic
|
||||
done
|
||||
else # not the first ip address
|
||||
if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then
|
||||
# ipv6
|
||||
if echo $nicip | grep : 2>&1 1>/dev/null
|
||||
then
|
||||
nmcli con add type infiniband con-name $nic ifname $nic ipv6.method manual ipv6.addresses $nicip
|
||||
else # ipv4
|
||||
prefix=$(convert_netmask_to_cidr $netmask)
|
||||
nmcli con add type infiniband con-name $nic ifname $nic ipv4.method manual ipv4.addresses $nicip/$prefix
|
||||
if nmcli --field connection.id con show $nic 2>&1 1>/dev/null
|
||||
then # modify current connection
|
||||
# ipv6
|
||||
if echo $nicip | grep : 2>&1 1>/dev/null
|
||||
then
|
||||
nmcli con modify $nic type infiniband con-name $nic ifname $nic ipv6.method manual ipv6.addresses $nicip
|
||||
else # ipv4
|
||||
prefix=$(convert_netmask_to_cidr $netmask)
|
||||
nmcli con modify $nic type infiniband con-name $nic ifname $nic ipv4.method manual ipv4.addresses $nicip/$prefix
|
||||
fi
|
||||
else # create new connection
|
||||
# ipv6
|
||||
if echo $nicip | grep : 2>&1 1>/dev/null
|
||||
then
|
||||
nmcli con add type infiniband con-name $nic ifname $nic ipv6.method manual ipv6.addresses $nicip
|
||||
else # ipv4
|
||||
prefix=$(convert_netmask_to_cidr $netmask)
|
||||
nmcli con add type infiniband con-name $nic ifname $nic ipv4.method manual ipv4.addresses $nicip/$prefix
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# ipv6
|
||||
@ -620,7 +644,7 @@ IPADDR$ipindex=$nicip"
|
||||
value="${array_extra_param_values[$i]}"
|
||||
echo " $i: name=$name value=$value"
|
||||
if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then
|
||||
nmcli con modify $con_name $name $value
|
||||
nmcli con modify $nic $name $value
|
||||
else
|
||||
grep -i "${name}" $cfgfile
|
||||
if [ $? -eq 0 ]; then
|
||||
|
Reference in New Issue
Block a user