From efc24bee4fc5dde2b41c2b3a61ecde1afc4f4de2 Mon Sep 17 00:00:00 2001 From: jjhua Date: Thu, 12 Apr 2012 08:13:55 +0000 Subject: [PATCH] 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 --- perl-xCAT/xCAT/FSPpower.pm | 11 +++++++---- perl-xCAT/xCAT/PPCpower.pm | 20 +++++++++++++++++++- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/perl-xCAT/xCAT/FSPpower.pm b/perl-xCAT/xCAT/FSPpower.pm index 462d3f9bc..66797a878 100644 --- a/perl-xCAT/xCAT/FSPpower.pm +++ b/perl-xCAT/xCAT/FSPpower.pm @@ -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) { diff --git a/perl-xCAT/xCAT/PPCpower.pm b/perl-xCAT/xCAT/PPCpower.pm index ad793f9f9..bd9f31b64 100644 --- a/perl-xCAT/xCAT/PPCpower.pm +++ b/perl-xCAT/xCAT/PPCpower.pm @@ -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 ); }