mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 11:22:27 +00:00 
			
		
		
		
	Merge pull request #6599 from cxhong/bondstr
Support multiple options for nicextraparams
This commit is contained in:
		| @@ -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"' | ||||
|  | ||||
|   | ||||
| @@ -121,6 +121,8 @@ nics Attributes: | ||||
|                      <nic1>!<param1=value1 param2=value2>,<nic2>!<param3=value3>, for example, eth0!MTU=1500,ib0!MTU=65520 CONNECTED_MODE=yes. | ||||
|                  If multiple ip addresses are associated with each NIC: | ||||
|                      <nic1>!<param1=value1 param2=value2>|<param3=value3>,<nic2>!<param4=value4 param5=value5>|<param6=value6>, 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.<nicname> as the sub attributes. | ||||
|   | ||||
|  | ||||
|   | ||||
| @@ -629,6 +629,8 @@ group Attributes: | ||||
|                      <nic1>!<param1=value1 param2=value2>,<nic2>!<param3=value3>, for example, eth0!MTU=1500,ib0!MTU=65520 CONNECTED_MODE=yes. | ||||
|                  If multiple ip addresses are associated with each NIC: | ||||
|                      <nic1>!<param1=value1 param2=value2>|<param3=value3>,<nic2>!<param4=value4 param5=value5>|<param6=value6>, 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.<nicname> as the sub attributes. | ||||
|   | ||||
|  | ||||
|   | ||||
| @@ -629,6 +629,8 @@ node Attributes: | ||||
|                      <nic1>!<param1=value1 param2=value2>,<nic2>!<param3=value3>, for example, eth0!MTU=1500,ib0!MTU=65520 CONNECTED_MODE=yes. | ||||
|                  If multiple ip addresses are associated with each NIC: | ||||
|                      <nic1>!<param1=value1 param2=value2>|<param3=value3>,<nic2>!<param4=value4 param5=value5>|<param6=value6>, 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.<nicname> as the sub attributes. | ||||
|   | ||||
|  | ||||
|   | ||||
| @@ -1626,6 +1626,8 @@ zvmivp => { | ||||
|                     <nic1>!<param1=value1 param2=value2>,<nic2>!<param3=value3>, for example, eth0!MTU=1500,ib0!MTU=65520 CONNECTED_MODE=yes. | ||||
|                 If multiple ip addresses are associated with each NIC: | ||||
|                     <nic1>!<param1=value1 param2=value2>|<param3=value3>,<nic2>!<param4=value4 param5=value5>|<param6=value6>, 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.<nicname> 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 | . <nic1>!<dev1>|<dev3>,<nic2>!<dev2>, e.g. bond0!eth0|eth2,br0!bond0. The xCAT object definition commands support to use nicdevices.<nicname> as the sub attributes.', | ||||
|             nicsadapter => 'Comma-separated list of NIC information collected by getadapter. <nic1>!<param1=value1 param2=value2>,<nic2>!<param4=value4 param5=value5>, for example, enP3p3s0f1!mac=98:be:94:59:fa:cd linkstate=DOWN,enP3p3s0f2!mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face', | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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