2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-22 03:00:26 +00:00

add --allownoip for confignetwork to ignore no nicips error (#4130)

This commit is contained in:
Yuan Bai
2017-10-19 16:12:23 +08:00
committed by Bin Xu
parent da60d783d0
commit 6e19ac5dc6

View File

@@ -81,6 +81,7 @@ function get_nic_cfg_file_content {
boot_install_nic=0
str_ib_nics=''
num_iba_ports=
ignore_nicips=0
for arg in "$@"
do
if [ "$arg" = "-s" ];then
@@ -88,6 +89,10 @@ do
elif [ "${arg:0:10}" = "--ibaports" ];then
num_iba_ports=${arg#--ibaports=}
fi
# --allownoip means ignore if nicips are not configured or not
if [ "$arg" = "--allownoip" ]; then
ignore_nicips=1
fi
done
if [ "$SETINSTALLNIC" = "1" ] || [ "$SETINSTALLNIC" = "yes" ]; then
bool_install_nic=1
@@ -336,8 +341,12 @@ function sort_nics_device_order {
echo $alonenic
fi
else
errorcode=1
echo "Error: nicips,nictypes and nicnetworks should be configured in nics table for $alonenic."
if [ $ignore_nicips -eq 1 ] && [ -z "$alonenicips" ]; then
echo "nic $alonenic found, but incomplete configuration in node definition."
else
errorcode=1
echo "Error: nicips,nictypes and nicnetworks should be configured in nics table for $alonenic."
fi
((num1+=1))
continue
fi
@@ -635,6 +644,9 @@ parser_nic_attribute "$NICTYPES" "nictypes"
#make hash for nicips
parser_nic_attribute "$NICIPS" "nicips"
#make hash for nicnetworks
parser_nic_attribute "$NICNETWORKS" "nicnetworks"
#make hash for niccustomscripts
parser_nic_attribute "$NICCUSTOMSCRIPTS" "niccustomscripts"
@@ -659,8 +671,14 @@ if [ $? -eq 0 ]; then
errorcode=1
fi
#when --allownoip is used, print incomplete nics
nonicips_list=`echo "$sorted_nicdevice_list" | grep "incomplete"`
if [ $? -eq 0 ]; then
echo "$nonicips_list"| log_lines info
fi
#delete invalid nics device pair based on Error
valid_sorted_nicdevice_list=`echo "$sorted_nicdevice_list" | sed '/Error/d'`
valid_sorted_nicdevice_list=`echo "$sorted_nicdevice_list" | sed '/Error/d' | sed '/incomplete configuration/d'`
if [ -n "$valid_sorted_nicdevice_list" ]; then
log_info "All valid nics and device list:"
echo "$valid_sorted_nicdevice_list" |log_lines info