diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/network/cfg_network_extra_param.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/network/cfg_network_extra_param.rst index 74e33d59e..6934cbec2 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/network/cfg_network_extra_param.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/network/cfg_network_extra_param.rst @@ -19,3 +19,7 @@ Use ``nicextraparams`` to customize attributes in NIC configuration file. For ex HWADDR=42:f5:0a:05:6a:09 MTU=1456 + #. Example to add `nicextraparams` to `bond` interface :: + + chdef cn1 nicextraparams.bond0='BONDING_OPTS="mode=active-backup;abc=100" MTU=6400 XYZ="4800" IOP="mode=1 phase=2"' + diff --git a/docs/source/guides/admin-guides/references/man5/nics.5.rst b/docs/source/guides/admin-guides/references/man5/nics.5.rst index 3ef6f1716..9fdf61ac3 100644 --- a/docs/source/guides/admin-guides/references/man5/nics.5.rst +++ b/docs/source/guides/admin-guides/references/man5/nics.5.rst @@ -121,6 +121,8 @@ nics Attributes: !,!, for example, eth0!MTU=1500,ib0!MTU=65520 CONNECTED_MODE=yes. If multiple ip addresses are associated with each NIC: !|,!|, for example, eth0!MTU=1500|MTU=1460,ib0!MTU=65520 CONNECTED_MODE=yes. + The semicolon separator is needed if there are multiple values for extra parameters: + bond0!BONDING_OPTS=lacp_rate=1;miimon=100;mode=802.3ad The xCAT object definition commands support to use nicextraparams. as the sub attributes. diff --git a/docs/source/guides/admin-guides/references/man7/group.7.rst b/docs/source/guides/admin-guides/references/man7/group.7.rst index 98c2710d1..45b7d3f85 100644 --- a/docs/source/guides/admin-guides/references/man7/group.7.rst +++ b/docs/source/guides/admin-guides/references/man7/group.7.rst @@ -629,6 +629,8 @@ group Attributes: !,!, for example, eth0!MTU=1500,ib0!MTU=65520 CONNECTED_MODE=yes. If multiple ip addresses are associated with each NIC: !|,!|, for example, eth0!MTU=1500|MTU=1460,ib0!MTU=65520 CONNECTED_MODE=yes. + The semicolon separator is needed if there are multiple values for extra parameters: + bond0!BONDING_OPTS=lacp_rate=1;miimon=100;mode=802.3ad The xCAT object definition commands support to use nicextraparams. as the sub attributes. diff --git a/docs/source/guides/admin-guides/references/man7/node.7.rst b/docs/source/guides/admin-guides/references/man7/node.7.rst index d94e998b7..e8ae749db 100644 --- a/docs/source/guides/admin-guides/references/man7/node.7.rst +++ b/docs/source/guides/admin-guides/references/man7/node.7.rst @@ -629,6 +629,8 @@ node Attributes: !,!, for example, eth0!MTU=1500,ib0!MTU=65520 CONNECTED_MODE=yes. If multiple ip addresses are associated with each NIC: !|,!|, for example, eth0!MTU=1500|MTU=1460,ib0!MTU=65520 CONNECTED_MODE=yes. + The semicolon separator is needed if there are multiple values for extra parameters: + bond0!BONDING_OPTS=lacp_rate=1;miimon=100;mode=802.3ad The xCAT object definition commands support to use nicextraparams. as the sub attributes. diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 0fbc23d1f..af756d208 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1626,6 +1626,8 @@ zvmivp => { !,!, for example, eth0!MTU=1500,ib0!MTU=65520 CONNECTED_MODE=yes. If multiple ip addresses are associated with each NIC: !|,!|, for example, eth0!MTU=1500|MTU=1460,ib0!MTU=65520 CONNECTED_MODE=yes. + The semicolon separator is needed if there are multiple values for extra parameters: + bond0!BONDING_OPTS=lacp_rate=1;miimon=100;mode=802.3ad The xCAT object definition commands support to use nicextraparams. as the sub attributes.', nicdevices => 'Comma-separated list of NIC device per NIC, multiple ethernet devices can be bonded as bond device, these ethernet devices are separated by | . !|,!, e.g. bond0!eth0|eth2,br0!bond0. The xCAT object definition commands support to use nicdevices. as the sub attributes.', nicsadapter => 'Comma-separated list of NIC information collected by getadapter. !,!, for example, enP3p3s0f1!mac=98:be:94:59:fa:cd linkstate=DOWN,enP3p3s0f2!mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face', diff --git a/xCAT/postscripts/nicutils.sh b/xCAT/postscripts/nicutils.sh index 9fd7b7b98..b4c6a6b6d 100755 --- a/xCAT/postscripts/nicutils.sh +++ b/xCAT/postscripts/nicutils.sh @@ -1820,7 +1820,13 @@ 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 + replacevalue="$name=$value" + sed -i "s/^$name=.*/$replacevalue/" $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 diff --git a/xCAT/postscripts/xcatlib.sh b/xCAT/postscripts/xcatlib.sh index 4c3cf0210..a24d06b2e 100755 --- a/xCAT/postscripts/xcatlib.sh +++ b/xCAT/postscripts/xcatlib.sh @@ -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 }