Xeon Phi support. Support nfs mount to any server which set in statelite table. Support power management setting.
This commit is contained in:
		| @@ -1469,7 +1469,7 @@ cfgmgt => { | ||||
|    }, | ||||
| }, | ||||
| mic => { | ||||
|     cols => [qw(node host id nodetype bridge onboot vlog comments disable)], | ||||
|     cols => [qw(node host id nodetype bridge onboot vlog powermgt comments disable)], | ||||
|     keys => [qw(node)], | ||||
|     table_desc => 'The host, slot id and configuraton of the mic (Many Integrated Core).', | ||||
|     descriptions => { | ||||
| @@ -1480,6 +1480,7 @@ mic => { | ||||
|         bridge => 'The virtual bridge on the host node which the mic connected to.', | ||||
|         onboot => 'Set mic to autoboot when mpss start. Valid values: yes|no. Default is yes.', | ||||
|         vlog => 'Set the Verbose Log to console. Valid values: yes|no. Default is no.', | ||||
|         powermgt => 'Set the Power Management for mic node. The value must be the [cpufreq=<on | off>]![corec6=<on | off>]![pc3=<on | off>]![pc6=<on | off>].', | ||||
|         comments => 'Any user-provided notes.', | ||||
|         disable => "Do not use.  tabprune will not work if set to yes or 1", | ||||
|     }, | ||||
| @@ -2457,6 +2458,11 @@ my @nodeattrs = ( | ||||
| 		tabentry => 'mic.vlog', | ||||
| 		access_tabentry => 'mic.node=attr:node', | ||||
| 	}, | ||||
| 	{attr_name => 'micpowermgt', | ||||
| 		only_if => 'mgt=mic', | ||||
| 		tabentry => 'mic.powermgt', | ||||
| 		access_tabentry => 'mic.node=attr:node', | ||||
| 	}, | ||||
| 	 | ||||
|   );	# end of @nodeattrs that applies to both nodes and groups | ||||
|  | ||||
|   | ||||
| @@ -674,7 +674,7 @@ sub nodeset { | ||||
|         xCAT::MsgUtils->message("E", {error=>["Cannot open the mic table."], errorcode=>["1"]}, $callback); | ||||
|         return; | ||||
|     } | ||||
|     my $michash = $mictab->getNodesAttribs($nodes, ['bridge', 'onboot', 'vlog']); | ||||
|     my $michash = $mictab->getNodesAttribs($nodes, ['bridge', 'onboot', 'vlog', 'powermgt']); | ||||
|  | ||||
|     # get ip for the mic nodes from hosts table | ||||
|     my $hosttab = xCAT::Table->new("hosts"); | ||||
| @@ -711,6 +711,13 @@ sub nodeset { | ||||
|     } | ||||
|     my @lfentall = $lftab->getAttribs({'image'=>'ALL'}, 'file', 'options'); | ||||
|  | ||||
|     # get the nfs server from statelite table | ||||
|     my $sltab = xCAT::Table->new('statelite'); | ||||
|     unless ($sltab) { | ||||
|         xCAT::MsgUtils->message("E", {error=>["Cannot open the statelite table."], errorcode=>["1"]}, $callback); | ||||
|         return; | ||||
|     } | ||||
|     my $slhash = $sltab->getNodesAttribs($nodes, ['statemnt']); | ||||
|  | ||||
|     # get the tftp dir and create the path for mic configuration | ||||
|     my $tftpdir = "/tftpboot"; | ||||
| @@ -801,6 +808,12 @@ sub nodeset { | ||||
|             if (defined ($michash->{$micname}->[0]->{'vlog'})) { | ||||
|                 $micattrs .= "|vlog=$michash->{$micname}->[0]->{'vlog'}"; | ||||
|             } | ||||
|             if (defined ($michash->{$micname}->[0]->{'powermgt'})) { | ||||
|                 $micattrs .= "|powermgt=$michash->{$micname}->[0]->{'powermgt'}"; | ||||
|             } | ||||
|             if (defined ($slhash->{$micname}->[0]->{'statemnt'})) { | ||||
|                 $micattrs .= "|statemnt=$slhash->{$micname}->[0]->{statemnt}"; | ||||
|             } | ||||
|             push @cfgfile, $micattrs; | ||||
|  | ||||
|         } | ||||
|   | ||||
| @@ -100,7 +100,7 @@ while (<CFGFILE>) { | ||||
|         my $deviceid = $1; | ||||
|         my @params = split (/\|/, $2); | ||||
|         foreach (@params) { | ||||
|             my ($n, $v) = split (/=/, $_); | ||||
|             my ($n, $v) = split (/=/, $_, 2); | ||||
|             $miccfg{$deviceid}{$n} = $v; | ||||
|             if ($n eq 'br') { | ||||
|                 $brgname = $v; | ||||
| @@ -290,10 +290,11 @@ foreach my $micid (keys %miccfg) { | ||||
|     # set the autoboot | ||||
|     if ($miccfg{$micid}{'onboot'} =~ /no/i) { | ||||
|         $cmd = "micctrl --autoboot=no mic$micid"; | ||||
|         runsyscmd ($cmd, "Error: failed to set the autoboot for mic.\n", 106); | ||||
|     } elsif($miccfg{$micid}{'onboot'} =~ /yes/i) { | ||||
|         $cmd = "micctrl --autoboot=yes mic$micid"; | ||||
|         runsyscmd ($cmd, "Error: failed to set the autoboot for mic.\n", 106); | ||||
|     } | ||||
|     runsyscmd ($cmd, "Error: failed to set the autoboot for mic.\n", 106); | ||||
|  | ||||
|     # set the hostname | ||||
|     $cmd = "sed \"s/Hostname .*/Hostname \"$micname\"/\" /etc/mpss/mic$micid.conf > $tmppath/mic$micid.conf"; | ||||
| @@ -307,14 +308,44 @@ foreach my $micid (keys %miccfg) { | ||||
|         copy ("$tmppath/mic$micid.conf", "/etc/mpss/mic$micid.conf"); | ||||
|     } | ||||
|  | ||||
|     # configure the power management | ||||
|     if (defined ($miccfg{$micid}{'powermgt'})) { | ||||
|         $cmd = "micctrl --pm=set "; | ||||
|         foreach my $item (split (/!/, $miccfg{$micid}{'powermgt'})) { | ||||
|             $cmd .= " --$item "; | ||||
|         } | ||||
|         $cmd .= " mic$micid"; | ||||
|         runsyscmd ($cmd, "Error: failed to set power management for mic.\n", 109); | ||||
|     } | ||||
|  | ||||
|     # configure network for each mic | ||||
|     $cmd = "micctrl --network=static --bridge=".$miccfg{$micid}{br}." --ip=".$miccfg{$micid}{ip}." mic$micid"; | ||||
|     runsyscmd ($cmd, "Error: failed to generate IP configuration for mic.\n", 104); | ||||
|  | ||||
|     # configure nfs mount for each mic | ||||
|     foreach my $msrc (keys %{$miccfg{'micmount'}}) { | ||||
|         $cmd = "micctrl --addnfs=$brgip:/$msrc --dir=$miccfg{micmount}{$msrc} mic$micid"; | ||||
|         my $mntsrc; | ||||
|         if (defined $miccfg{$micid}{'statemnt'}) { | ||||
|             if ($miccfg{$micid}{'statemnt'} =~ /:/) { | ||||
|                 # for 'statemnt' is a nfs server plus dir like 192.168.1:/nfs | ||||
|                 $mntsrc = $miccfg{$micid}{'statemnt'}."/$msrc"; | ||||
|             } else { | ||||
|                 # for 'statemnt' is a nfs server ip 192.168.0.1 | ||||
|                 $mntsrc = $miccfg{$micid}{'statemnt'}.":/$msrc"; | ||||
|             } | ||||
|         } else { | ||||
|             $mntsrc = "$brgip:/$msrc"; | ||||
|         } | ||||
|         $cmd = "micctrl --addnfs=$mntsrc --dir=$miccfg{micmount}{$msrc} mic$micid"; | ||||
|         runsyscmd ($cmd, "Error: failed to add nfs mount for mic.\n", 104); | ||||
|  | ||||
|         # since there's a bug that nfsserver cannot be set, just manully change it | ||||
|         if ($mntsrc =~ /^(.+):/) { | ||||
|             if ($1 ne $brgip) { | ||||
|                 $cmd = "sed -i \'s/$brgip/$1/g\' /var/mpss/mic$micid/etc/fstab"; | ||||
|                 runsyscmd ($cmd, "Error: failed to hack nfs mount for mic.\n", 104); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     # take the configuration to effect | ||||
|   | ||||
		Reference in New Issue
	
	Block a user