diff --git a/perl-xCAT/xCAT/PPCcli.pm b/perl-xCAT/xCAT/PPCcli.pm index 4b6608771..35d9d739d 100644 --- a/perl-xCAT/xCAT/PPCcli.pm +++ b/perl-xCAT/xCAT/PPCcli.pm @@ -51,11 +51,21 @@ my %powercmd = ( sys => { reset =>"chsysstate -r %s -m %s -o off --immed --restart", on =>"chsysstate -r %s -m %s -o on", + onstandby =>"chsysstate -r %s -m %s -o onstandby", off =>"chsysstate -r %s -m %s -o off", boot =>"undetermined" } ); - +############################################## +# lsrefcode supported formats +############################################## +my %lsrefcode = ( + fsp => { + pri =>"lsrefcode -r sys -m %s -s p", + sec =>"lsrefcode -r sys -m %s -s s", + }, + lpar =>"lsrefcode -r lpar -m %s --filter lpar_ids=%s", +); ########################################################################## # Logon to remote server @@ -288,6 +298,39 @@ sub chsyscfg { return( $result ); } +########################################################################## +# List reference codes for resources (lpars, managed system, etc) +########################################################################## +sub lsrefcode { + + my $exp = shift; + my $res = shift; + my $d1 = shift; + my $d2 = shift; + my $cmd = undef; + my @cmds = undef; + my $result = undef; + my @values; + + ################################### + # Select command + ################################### + if($res eq 'fsp'){ + $cmds[0] = sprintf($lsrefcode{$res}{pri}, $d1); + $cmds[1] = sprintf($lsrefcode{$res}{sec}, $d1); + } elsif($res eq 'lpar'){ + $cmds[0] = sprintf($lsrefcode{$res}, $d1, $d2); + } + + ################################### + # Send command + ################################### + foreach $cmd (@cmds){ + $result = send_cmd( $exp, $cmd ); + push @values, $result; + } + return \@values; +} ########################################################################## # Creates a logical partition on the managed system @@ -906,7 +949,6 @@ sub send_cmd { ########################################## $ssh->clear_accum(); $ssh->send( "$cmd; echo Rc=\$\?\r" ); - ########################################## # The first element is the number of the # pattern or string that matched, the diff --git a/perl-xCAT/xCAT/PPCpower.pm b/perl-xCAT/xCAT/PPCpower.pm index b8204b762..a4fa9cb28 100644 --- a/perl-xCAT/xCAT/PPCpower.pm +++ b/perl-xCAT/xCAT/PPCpower.pm @@ -15,7 +15,7 @@ sub parse_args { my $command = $request->{command}; my $args = $request->{arg}; my %opt = (); - my @rpower = qw(on off stat state reset boot of); + my @rpower = qw(on onstandby off stat state reset boot of); ############################################# # Responds with usage statement diff --git a/perl-xCAT/xCAT/PPCvitals.pm b/perl-xCAT/xCAT/PPCvitals.pm index b94950278..e82f6e41d 100644 --- a/perl-xCAT/xCAT/PPCvitals.pm +++ b/perl-xCAT/xCAT/PPCvitals.pm @@ -16,7 +16,7 @@ sub parse_args { my $command = $request->{command}; my $args = $request->{arg}; my %opt = (); - my @rvitals = qw(temp voltage power state all); + my @rvitals = qw(temp voltage power lcds state all); ############################################# # Responds with usage statement @@ -128,6 +128,37 @@ sub enumerate_temp { return( [SUCCESS,\%outhash] ); } +########################################################################## +# Returns refcode +########################################################################## +sub enumerate_lcds { + + my $exp = shift; + my $d = shift; + my $mtms = @$d[2]; + my $Rc = undef; + my $value = undef; + my $nodetype = @$d[4]; + my $lpar_id = @$d[0]; + my @refcode = (); + + my $values = xCAT::PPCcli::lsrefcode($exp, $nodetype, $mtms, $lpar_id); + foreach $value (@$values){ + #Return error + $Rc = shift @$value; + if ($Rc != SUCCESS){ + push @refcode, ( [$Rc, @$value[0]] ); + } else { + if( @$value[0] =~ /refcode=(\w+)/){ + push @refcode, ( [$Rc, $1] ); + } else { + push @refcode, ( [$Rc, @$value[0]]); + } + } + } + + return \@refcode; +} ########################################################################## @@ -292,7 +323,43 @@ sub power { sub state { return( xCAT::PPCpower::state(@_,"System State: ")); } - +########################################################################### +# Returns system LCD status (LCD1, LCD2) +########################################################################## +sub lcds { + my $request = shift; + my $hash = shift; + my $exp = shift; + my $hwtype = @$exp[2]; + my @result = (); + my $text = "Current LCD:"; + my $prefix = "Current LCD%d: %s"; + my $rcode = undef; + my $refcodes = undef; + my $Rc = undef; + my $num = undef; + my $value = undef; + + while (my ($mtms,$h) = each(%$hash) ) { + while(my ($name, $d) = each(%$h) ){ + #Support HMC only + if($hwtype ne 'hmc'){ + push @result, [$name, "$text Not available(NO HMC)", 1]; + next; + } + $refcodes = enumerate_lcds($exp, $d); + $num = 1; + foreach $rcode (@$refcodes){ + $Rc = shift(@$rcode); + $value = sprintf($prefix, $num, @$rcode[0]); + push @result, [$name, $value, $Rc]; + $num = $num + 1; + } + } + } + return \@result; +} + ########################################################################## # Returns all vitals @@ -303,7 +370,8 @@ sub all { @{temp(@_)}, @{voltage(@_)}, @{state(@_)}, - @{power(@_)} + @{power(@_)}, + @{lcds(@_)}, ); return( \@values ); } diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 80f0ba994..265df8b2a 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -20,16 +20,18 @@ my %usage = ( "Usage: rnetboot [-f][-V|--verbose] rnetboot [-h|--help|-v|--version]", "rpower" => -"Usage: rpower [--nodeps][on|off|reset|stat|state|boot|cycle|softoff] [-V|--verbose] +"Usage: rpower [--nodeps][on|onstandby|off|reset|stat|state|boot|cycle|softoff] [-V|--verbose] rpower [-h|--help|-v|--version] PPC (with IVM or HMC) specific: rpower [--nodeps] [of] [-V|--verbose] + PPC (HMC) specific: + rpower [onstandby] [-V|--verbose] ", "rbeacon" => "Usage: rbeacon [on|off|stat] [-V|--verbose] rbeacon [-h|--help|-v|--version]", "rvitals" => -"Usage: rvitals [all|temp|wattage|voltage|fanspeed|power|leds|state] [-V|--verbose] +"Usage: rvitals [all|temp|wattage|voltage|fanspeed|power|leds|lcds|state] [-V|--verbose] rvitals [-h|--help|-v|--version]", "reventlog" => "Usage: reventlog [all|clear|] [-V|--verbose] diff --git a/xCAT-client/pods/man1/rpower.1.pod b/xCAT-client/pods/man1/rpower.1.pod index 67091383f..68e98f534 100644 --- a/xCAT-client/pods/man1/rpower.1.pod +++ b/xCAT-client/pods/man1/rpower.1.pod @@ -4,7 +4,7 @@ B - remote power control of nodes =head1 SYNOPSIS -B I [B<--nodeps>] {B|B|B|B|B|B|B|B} +B I [B<--nodeps>] {B|B|B|B|B|B|B|B|B} B [B<-h>|B<--help>|B<-v>|B<--version>] @@ -12,6 +12,10 @@ B [B<-h>|B<--help>|B<-v>|B<--version>] B I [B<--nodeps>] {B} +=head2 PPC (with HMC) specific: + +B I [B] + =head1 DESCRIPTION B controls the power for a single or range of nodes, via the out-of-band path. @@ -24,6 +28,10 @@ B controls the power for a single or range of nodes, via the out-of-ban Turn power on. +=item B + +Turn power on to standby state + =item B Attempt to request clean shutdown of OS (may not detect failures in completing command) diff --git a/xCAT-client/pods/man1/rvitals.1.pod b/xCAT-client/pods/man1/rvitals.1.pod index 0a9854ad1..26fbc59fb 100644 --- a/xCAT-client/pods/man1/rvitals.1.pod +++ b/xCAT-client/pods/man1/rvitals.1.pod @@ -4,7 +4,7 @@ B - remote hardware vitals =head1 B -B I {B|B|B|B|B|B|B|B} +B I {B|B|B|B|B|B|B|B|B} B [B<-h>|B<--help>|B<-v>|B<--version>] @@ -59,6 +59,10 @@ unless the Service Processor flash gets updated. Retrieves the system state. +=item B + +Retrieves LCDs status. + =item B All of the above. @@ -95,6 +99,7 @@ B I I node5: Fan 5 Percent of max: 100% node5: Fan 6 Percent of max: 100% node5: Current Power Status On + node5: Current LCD1: SuSE Linux node5: Power On Seconds 11855915 node5: Number of Reboots 930 node5: System State Booting OS or in unsupported OS