2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-02 11:37:07 +00:00

add autoconnect-priority for xCAT nmcli con and fix RH7.6 failure

This commit is contained in:
bybai 2019-03-26 03:15:49 -04:00
parent 7e99e3af1a
commit 7e5c5fa093
3 changed files with 23 additions and 22 deletions

View File

@ -141,7 +141,7 @@ function configipv4(){
tmp_con_name=$con_name"-tmp"
nmcli con modify $con_name connection.id $tmp_con_name
fi
nmcli con add type ethernet con-name $con_name ifname ${str_if_name} ipv4.method manual ipv4.addresses ${str_v4ip}/${str_prefix}
nmcli con add type ethernet con-name $con_name ifname ${str_if_name} ipv4.method manual ipv4.addresses ${str_v4ip}/${str_prefix} connection.autoconnect-priority 9
else
echo "DEVICE=${str_if_name}" > $str_conf_file
echo "BOOTPROTO=none" >> $str_conf_file
@ -636,7 +636,7 @@ elif [ "$1" = "-s" ];then
tmp_con_name=${str_inst_nic}"-tmp"
nmcli con modify $con_name connection.id $tmp_con_name
fi
nmcli con add type ethernet con-name $con_name ifname ${str_inst_nic} ipv4.method manual ipv4.addresses ${str_inst_ip}/${str_inst_prefix}
nmcli con add type ethernet con-name $con_name ifname ${str_inst_nic} ipv4.method manual ipv4.addresses ${str_inst_ip}/${str_inst_prefix} connection.autoconnect-priority 9
else
echo "DEVICE=${str_inst_nic}" > $str_conf_file
echo "IPADDR=${str_inst_ip}" >> $str_conf_file
@ -1111,10 +1111,10 @@ else
nmcli con up $con_name
wait_for_ifstate $str_nic_name UP 10 10
else
ip link set dev $con_name up
ip link set dev $str_nic_name up
fi
if [ $? -ne 0 ]; then
log_error "bring $con_name up failed."
log_error "bring $str_nic_name up failed."
error_code=1
fi
fi

View File

@ -633,6 +633,18 @@ errorcode=0
#nictypes should support capital letters, for example, Ethernet and ethernet
utolcmd="sed -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
#check if using NetworkManager or network service
networkmanager_active=2
check_NetworkManager_or_network_service
is_active=$?
if [ $is_active -eq 0 ]; then
networkmanager_active=0
elif [ $is_active -eq 1 ]; then
networkmanager_active=1
else
exit 1
fi
#back up all network interface configure files
nwdirbak=$nwdir".xcatbak"
ls $nwdirbak > /dev/null 2>/dev/null
@ -644,17 +656,6 @@ if [ $? -ne 0 ]; then
fi
fi
#check if using NetworkManager or network service
networkmanager_active=2
check_NetworkManager_or_network_service
if [ $? -eq 0 ]; then
networkmanager_active=0
elif [ $? -eq 1 ]; then
networkmanager_active=1
else
exit 1
fi
#get for installnic
installnic=''
installnic=`get_installnic`

View File

@ -1751,7 +1751,7 @@ function create_vlan_interface_nmcli {
$nmcli con modify $con_name connection.id $tmp_con_name
fi
$nmcli con add type vlan con-name $con_name dev $ifname id $(( 10#$vlanid )) $_ipaddrs $_mtu
$nmcli con add type vlan con-name $con_name dev $ifname id $(( 10#$vlanid )) $_ipaddrs $_mtu connection.autoconnect-priority 9
log_info "create NetworkManager connection for $ifname.$vlanid"
if [ -z "$next_nic" ]; then
$nmcli con up $con_name
@ -1888,7 +1888,7 @@ function create_bridge_interface_nmcli {
fi
fi
log_info "create bridge connection $xcat_con_name"
cmd="$nmcli con add type bridge con-name $xcat_con_name ifname $ifname $_mtu"
cmd="$nmcli con add type bridge con-name $xcat_con_name ifname $ifname $_mtu connection.autoconnect-priority 9"
log_info $cmd
$cmd
if [ $? -ne 0 ]; then
@ -1924,10 +1924,10 @@ function create_bridge_interface_nmcli {
fi
con_use_same_dev=$(nmcli dev show $_port|grep GENERAL.CONNECTION|awk -F: '{print $2}'|sed 's/^[ \t]*//g')
if [ "$con_use_same_dev" != "--" -a -n "$con_use_same_dev" ]; then
cmd="$nmcli con mod "$con_use_same_dev" master $ifname $_mtu"
cmd="$nmcli con mod "$con_use_same_dev" master $ifname $_mtu connection.autoconnect-priority 9"
xcat_slave_con=$con_use_same_dev
else
cmd="$nmcli con add type $_pretype con-name $xcat_slave_con ifname $_port master $ifname $_mtu"
cmd="$nmcli con add type $_pretype con-name $xcat_slave_con ifname $_port master $ifname $_mtu connection.autoconnect-priority 9"
fi
log_info "create $_pretype slaves connetcion $xcat_slave_con for bridge"
log_info "$cmd"
@ -2098,9 +2098,9 @@ function create_bond_interface_nmcli {
log_info "create bond connection $xcat_con_name"
cmd=""
if [ -n "$next_nic" ]; then
cmd="$nmcli con add type bond con-name $xcat_con_name ifname $bondname bond.options $_bonding_opts autoconnect yes"
cmd="$nmcli con add type bond con-name $xcat_con_name ifname $bondname bond.options $_bonding_opts autoconnect yes connection.autoconnect-priority 9"
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"
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"
fi
log_info $cmd
$cmd
@ -2144,7 +2144,7 @@ function create_bond_interface_nmcli {
$ip link set dev $ifslave down
wait_for_ifstate $ifslave DOWN 20 2
fi
cmd="$nmcli con add type $slave_type con-name $xcat_slave_con $_mtu method none ifname $ifslave master $xcat_con_name autoconnect yes"
cmd="$nmcli con add type $slave_type con-name $xcat_slave_con $_mtu method none ifname $ifslave master $xcat_con_name autoconnect yes connection.autoconnect-priority 9"
log_info $cmd
$cmd
if [ $? -ne 0 ]; then