diff --git a/xCAT/postscripts/confignetwork b/xCAT/postscripts/confignetwork index 39fce3b8d..47f0e75c5 100755 --- a/xCAT/postscripts/confignetwork +++ b/xCAT/postscripts/confignetwork @@ -524,7 +524,10 @@ function configure_nicdevice { nic_pair=`echo "$nics_pair" |sed -n "${num}p"` echo "configure nic and its device : $nic_pair" ipaddrs=$(find_nic_ips $nic_dev) - next_nic=$(echo "$nics_pair"|awk /${nic_dev}$/'{ print $1}') + # if a device is middle device, it may have no IP, for example, configure eth0->vlan.1->br0, vlan1.1 is middle device + # is_mid_device is to label if ${nic_dev} is middle device + # if $is_mid_device has value, the ${nic_dev} is middle device, or else, it is not middle device + is_mid_device=$(echo "$nics_pair"|awk /${nic_dev}$/'{ print $1}') #ignore bmc interfaces. They're allowed in the nics table to generate DNS/hostname records, but they #can't be configured here (it's done in bmcsetup if [ x"$nic_dev_type" = "xbmc" ]; then @@ -582,7 +585,7 @@ function configure_nicdevice { if [ "$networkmanager_active" = "0" ]; then create_vlan_interface ifname=$vlanname vlanid=$vlanid elif [ "$networkmanager_active" = "1" ]; then - create_vlan_interface_nmcli ifname=$vlanname vlanid=$vlanid ipaddrs=$ipaddrs next_nic=$next_nic + create_vlan_interface_nmcli ifname=$vlanname vlanid=$vlanid ipaddrs=$ipaddrs next_nic=$is_mid_device fi if [ $? -ne 0 ]; then log_error "configure VLAN failed." @@ -593,7 +596,7 @@ function configure_nicdevice { if [ "$networkmanager_active" = "0" ]; then create_bond_interface ifname=$nic_dev slave_ports=$base_nic_for_bond slave_type=$base_nic_type elif [ "$networkmanager_active" = "1" ]; then - create_bond_interface_nmcli bondname=$nic_dev slave_ports=$base_nic_for_bond slave_type=$base_nic_type _ipaddr=$ipaddrs next_nic=$next_nic + create_bond_interface_nmcli bondname=$nic_dev slave_ports=$base_nic_for_bond slave_type=$base_nic_type _ipaddr=$ipaddrs next_nic=$is_mid_device fi if [ $? -ne 0 ]; then log_error "configure bond $nic_dev failed." @@ -628,7 +631,7 @@ errorcode=0 utolcmd="sed -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" #back up all network interface configure files -nwdirbak="/tmp/" +nwdirbak=$nwdir".xcatbak" ls $nwdirbak > /dev/null 2>/dev/null if [ $? -ne 0 ]; then log_info "back up $nwdir to $nwdirbak" diff --git a/xCAT/postscripts/nicutils.sh b/xCAT/postscripts/nicutils.sh index cd52a76b1..70088a4a4 100755 --- a/xCAT/postscripts/nicutils.sh +++ b/xCAT/postscripts/nicutils.sh @@ -2123,7 +2123,7 @@ function create_bond_interface_nmcli { if [ $? -eq 0 ] ; then is_connection_activate_intime $xcat_slave_con 1 if [ $? -eq 1 ]; then - $nmcli con down $xcat_con_name + $nmcli con down $xcat_slave_con ip link set dev $ifslave down wait_for_ifstate $ifslave DOWN 40 1 fi