mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-07-23 12:51:10 +00:00
support multiple options for nicextraparams
This commit is contained in:
@@ -1820,7 +1820,12 @@ function add_extra_params_nmcli {
|
||||
name="${array_extra_param_names[$i]}"
|
||||
value="${array_extra_param_values[$i]}"
|
||||
if [ -n "$name" -a -n "$value" ]; then
|
||||
echo "$name=$value" >> $str_conf_file
|
||||
grep $name $str_conf_file >/dev/null 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
sed -i 's/^$name.*/$name=\"$vlaue\"/g' $str_conf_file
|
||||
else
|
||||
echo "$name="$value"" >> $str_conf_file
|
||||
fi
|
||||
else
|
||||
log_error "invalid extra params $name $value, please check nics.nicextraparams"
|
||||
rc=1
|
||||
|
@@ -710,11 +710,12 @@ function get_nic_extra_params() {
|
||||
# This functions parse the extra parameters for an ip address of a nic
|
||||
# Input is like this:
|
||||
# MTU=65520 something=yes
|
||||
# MTU=65520 something=yes;no;maybe
|
||||
# After the function is called:
|
||||
# array_extra_param_names[0]="MTU"
|
||||
# array_extra_param_values[0]="65520"
|
||||
# array_extra_param_names[1]="something"
|
||||
# array_extra_param_values[0]="yes"
|
||||
# array_extra_param_values[1]="yes" or array_extra_param_values[1]="yes no maybe"
|
||||
#
|
||||
function parse_nic_extra_params() {
|
||||
str_extra=$1
|
||||
@@ -731,7 +732,7 @@ function parse_nic_extra_params() {
|
||||
do
|
||||
token2="${params_temp[$k]}"
|
||||
array_extra_param_names[$k]=`echo "$token2" | cut -d'=' -f 1`
|
||||
array_extra_param_values[$k]=`echo "$token2" | cut -d'=' -f 2-`
|
||||
array_extra_param_values[$k]=`echo "$token2" | cut -d'=' -f 2- | sed 's,\;, ,g'`
|
||||
k=$((k+1))
|
||||
done
|
||||
}
|
||||
|
Reference in New Issue
Block a user