rpower cec onstandby -T tooltype support

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12219 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jjhua 2012-04-12 08:13:55 +00:00
parent 211cf80b67
commit efc24bee4f
2 changed files with 26 additions and 5 deletions

View File

@ -23,6 +23,7 @@ sub enumerate {
my $h = shift;
my $mtms = shift;
my $tooltype = shift;
my %outhash = ();
my %cmds = ();
my $type = ();
@ -44,7 +45,7 @@ sub enumerate {
}
foreach my $type ( keys %cmds ) {
my $action = $cmds{$type};
my $values = xCAT::FSPUtils::fsp_state_action ($cec_bpa, $type, $action);;
my $values = xCAT::FSPUtils::fsp_state_action ($cec_bpa, $type, $action, $tooltype);
my $Rc = shift(@$values);
##################################
# Return error
@ -170,6 +171,7 @@ sub powercmd {
my $request = shift;
my $hash = shift;
my $tooltype = $request->{opt}->{T};
my @result = ();
my @output;
my $action;
@ -270,7 +272,7 @@ sub powercmd {
#print Dumper($newd);
my $res = xCAT::FSPUtils::fsp_api_action($newnames, $newd, $action, 0, $request->{'powerinterval'} );
my $res = xCAT::FSPUtils::fsp_api_action($newnames, $newd, $action, $tooltype, $request->{'powerinterval'} );
# print "In boot, state\n";
# print Dumper($res);
my $Rc = @$res[2];
@ -340,6 +342,7 @@ sub state {
my $prefix = shift;
my $convert = shift;
my @output = ();
my $tooltype = $request->{opt}->{T};
#print "------in state--------\n";
@ -374,7 +377,7 @@ sub state {
######################################
# Build CEC/LPAR information hash
######################################
my $stat = enumerate( $h, $mtms );
my $stat = enumerate( $h, $mtms, $tooltype);
my $Rc = shift(@$stat);
my $data = @$stat[0];
#if($Rc != 0) {
@ -404,7 +407,7 @@ sub state {
# Node not found
##################################
if ($type !~ /^blade$/ and !exists( $data->{$id} )) {
my $res = xCAT::FSPUtils::fsp_api_action($name, $d, "state");
my $res = xCAT::FSPUtils::fsp_api_action($name, $d, "state", $tooltype);
my $rc = @$res[2];
my $val = @$res[1];
if( $rc != 0) {

View File

@ -40,7 +40,7 @@ sub parse_args {
$Getopt::Long::ignorecase = 0;
Getopt::Long::Configure( "bundling" );
if ( !GetOptions( \%opt, qw(V|Verbose m:s@ t=s r=s nodeps) )) {
if ( !GetOptions( \%opt, qw(V|Verbose m:s@ t=s T=s r=s nodeps) )) {
return( usage() );
}
####################################
@ -83,6 +83,24 @@ sub parse_args {
return(usage());
}
}
if( ! exists $opt{T} )
{
$opt{T} = "lpar"; #defaut value is lpar.
}
if( $opt{T} eq "lpar") {
$opt{T} = 0;
} elsif($opt{T} eq "fnm") {
$opt{T} = 1;
if ( $request->{op} !~ /^(onstandby|state|stat)$/) {
return(usage("The tooltype fnm only could be used with onstandby/state/stat action."));
}
} else {
return( usage('Wrong value of -T option. The value can be lpar or fnm. The defaut value is lpar.'));
}
return( \%opt );
}