sync Frame, CEC sysname feature
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9975 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
e7a471ecba
commit
05ab449599
@ -152,7 +152,11 @@ sub fsp_api_action {
|
||||
$cmd = "$fsp_api -a $action -T $tooltype -f $parameter -t $type:$fsp_ip:$id:$node_name:";
|
||||
} else {
|
||||
if( defined($parameter) ) {
|
||||
$cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:$parameter";
|
||||
if ($action =~ /^(set_frame_name|set_cec_name)$/) {
|
||||
$cmd = "$fsp_api -a $action -n $parameter -T $tooltype -t $type:$fsp_ip:$id:$node_name:";
|
||||
} else {
|
||||
$cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:$parameter";
|
||||
}
|
||||
} else {
|
||||
$cmd = "$fsp_api -a $action -T $tooltype -t $type:$fsp_ip:$id:$node_name:";
|
||||
}
|
||||
|
@ -51,7 +51,8 @@ sub parse_args {
|
||||
"general_passwd",
|
||||
"*_passwd",
|
||||
"cec_off_policy",
|
||||
"resetnet"
|
||||
"resetnet",
|
||||
"sysname"
|
||||
);
|
||||
my @frame = (
|
||||
"frame",
|
||||
@ -59,7 +60,8 @@ sub parse_args {
|
||||
"admin_passwd",
|
||||
"general_passwd",
|
||||
"*_passwd",
|
||||
"resetnet"
|
||||
"resetnet",
|
||||
"sysname"
|
||||
);
|
||||
|
||||
|
||||
@ -190,6 +192,11 @@ sub parse_args {
|
||||
$request->{method} = "resetnet";
|
||||
return( \%opt );
|
||||
}
|
||||
if(exists($cmds{sysname})) {
|
||||
$request->{hcp} = $request->{hwtype} eq 'frame' ? "bpa":"fsp";
|
||||
$request->{method} = "sysname";
|
||||
return (\%opt);
|
||||
}
|
||||
####################################
|
||||
# Return method to invoke
|
||||
####################################
|
||||
@ -242,11 +249,106 @@ sub parse_option {
|
||||
return( "Invalid cec_off_policy '$value'" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($command eq 'sysname') {
|
||||
if ($value ne '*') {
|
||||
if ($value !~ /^[a-zA-Z0-9-_]+$/) {
|
||||
return( "Invalid sysname '$value'" );
|
||||
} elsif (scalar(@{$request->{node}}) gt '1') {
|
||||
return( "Invalid sysname '$value'" );
|
||||
}
|
||||
my $len = rindex $value."\$", "\$";
|
||||
if ($len > '31') {
|
||||
return ("Invalid sysname '$value', name is too long, max 31 characters");
|
||||
}
|
||||
}
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
sub sysname_check_node_info {
|
||||
my $hash = shift;
|
||||
my $invalid_node = undef;
|
||||
while (my ($mtsm, $h) = each (%$hash)) {
|
||||
while (my ($name, $d) = each(%$h)) {
|
||||
if (@$d[4] !~ /^(cec|frame)$/) {
|
||||
$invalid_node = $name;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $invalid_node;
|
||||
}
|
||||
|
||||
my %sysname_action = (
|
||||
query => {
|
||||
cec => "get_cec_name",
|
||||
frame => "get_frame_name"
|
||||
},
|
||||
set => {
|
||||
cec => "set_cec_name",
|
||||
frame => "set_frame_name"
|
||||
}
|
||||
);
|
||||
sub do_query_sysname {
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my @result = ();
|
||||
while (my ($mtms, $h) = each(%$hash)) {
|
||||
while (my($name, $d) = each(%$h)) {
|
||||
my $action = $sysname_action{query}{@$d[4]};
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($name, $d, $action);
|
||||
push @result, $values;
|
||||
if (@$values[2] != 0) {
|
||||
last;
|
||||
} else {
|
||||
my $len = rindex @$values[1]."\$", "\$";
|
||||
if ($len > '31') {
|
||||
return ([[$name, "Get sysname failed, name is too long, max 31 characters", "1"]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (\@result);
|
||||
}
|
||||
sub do_set_sysname {
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my $value = shift;
|
||||
my @result = ();
|
||||
while (my ($mtms, $h) = each(%$hash)) {
|
||||
while (my($name, $d) = each(%$h)) {
|
||||
my $sysname = ($value eq '*') ? $name : $value;
|
||||
my $action = $sysname_action{set}{@$d[4]};
|
||||
my $values = xCAT::FSPUtils::fsp_api_action($name, $d, $action, 0, $sysname);
|
||||
push @result, $values;
|
||||
if (@$values[2] != 0) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (\@result);
|
||||
}
|
||||
sub sysname {
|
||||
my $request = shift;
|
||||
my $hash = shift;
|
||||
my $exp = shift;
|
||||
my $args = $request->{arg};
|
||||
my $invalid_node = &sysname_check_node_info($hash);
|
||||
if (defined($invalid_node)) {
|
||||
retrun ([[$invalid_node, "Node must be CEC or Frame", '1']]);
|
||||
}
|
||||
foreach my $arg (@$args) {
|
||||
my ($cmd, $value) = split /=/, $arg;
|
||||
if ($cmd !~ /^sysname$/) {
|
||||
return ([[$cmd, "Can't be exec with sysname", 1]]);
|
||||
}
|
||||
if ($value) {
|
||||
return &do_set_sysname($request, $hash, $value)
|
||||
} else {
|
||||
return &do_query_sysname($request, $hash);
|
||||
}
|
||||
}
|
||||
return ([["Error", "Arguments invalid", 1]]);
|
||||
}
|
||||
##########################################################################
|
||||
# Update passwords for different users on FSP/BPA
|
||||
##########################################################################
|
||||
|
@ -139,6 +139,9 @@ my %usage = (
|
||||
rspconfig <noderange> [dev|celogin1]
|
||||
rspconfig <noderange> [dev=<enable|disable>]|
|
||||
rspconfig <noderange> [celogin1=<enable|disable>]
|
||||
Frame/CEC Specific:
|
||||
rspconfig <noderange> [sysname]
|
||||
rspconfig <noderange> [sysname=<*|name>]
|
||||
",
|
||||
"getmacs" =>
|
||||
"Usage:
|
||||
|
@ -152,6 +152,13 @@ B<rspconfig> I<noderange> B<sshcfg>={B<enable>|B<disable>}
|
||||
|
||||
B<rspconfig> I<noderange> B<--resetnet>
|
||||
|
||||
=head2 HMC Specific:
|
||||
|
||||
B<rspconfig> I<noderange> {B<sysname>}
|
||||
|
||||
B<rspconfig> I<noderange> B<sysname>={B<*>|B<name>}
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<rspconfig> configures various settings in the nodes' service processors. If only a keyword is
|
||||
@ -306,6 +313,10 @@ Set the Switch network parameters.
|
||||
|
||||
Performs a system dump.
|
||||
|
||||
=item B<sysname>
|
||||
|
||||
Query or set sysname for CEC or Frame. If no value specified, means to query sysname of the specified nodes. If '*' specified, it means to set sysname for the specified nodes, and the sysname values would get from xCAT datebase. If a string was specified, it means to use the string as sysname value to set for the specified node.
|
||||
|
||||
=item B<time>={I<hh:mm:ss>}
|
||||
|
||||
Enter the current time in UTC (Coordinated Universal Time) format.
|
||||
@ -506,6 +517,22 @@ B<rspconfig> I<mm01 procedecfg=deconfigure:0:4,5>
|
||||
|
||||
=item *
|
||||
|
||||
To check if CEC sysname set correct:
|
||||
|
||||
B<rspconfig> I<mm01 sysname>
|
||||
|
||||
mm01: mm01
|
||||
|
||||
B<rspconfig> I<mm01 sysname=frame1>
|
||||
|
||||
mm01: success
|
||||
|
||||
B<rspconfig> I<mm01 sysname>
|
||||
|
||||
mm01: frame1
|
||||
|
||||
=item *
|
||||
|
||||
To deconfigure memory bank 9 and 10 of Processing Unit 0 on mm01:
|
||||
|
||||
B<rspconfig> I<mm01 memdecfg=deconfigure:bank:0:9,10>
|
||||
@ -528,8 +555,8 @@ Output is similar to:
|
||||
Server-8233-E8B-SN1000ECP-A,Server-9119-FHA-SN0275995-B,Server-9119-FHA-SN0275995-A,
|
||||
|
||||
Reset network finished.
|
||||
|
||||
=item *
|
||||
|
||||
=back
|
||||
|
||||
To update the existing admin password on fsp:
|
||||
|
||||
@ -537,16 +564,12 @@ B<rspconfig> I<fsp admin_passwd=admin,abc123>
|
||||
|
||||
fsp: Success
|
||||
|
||||
=item *
|
||||
|
||||
To set the initial password for user HMC on fsp:
|
||||
|
||||
B<rspconfig> I<fsp HMC_passwd=,abc123>
|
||||
|
||||
fsp: Success
|
||||
|
||||
=back
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<noderange(3)|noderange.3>, L<rpower(1)|rpower.1>, L<rcons(1)|rcons.1>, L<rinv(1)|rinv.1>, L<rvitals(1)|rvitals.1>, L<rscan(1)|rscan.1>, L<rflash(1)|rflash.1>
|
||||
|
Loading…
Reference in New Issue
Block a user