From 45255ab48c30ce1c840e6121b84dbaae02f57999 Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 27 Apr 2017 02:33:19 -0400 Subject: [PATCH 1/4] fix issue 2948, add bmc specific for rpower in usage & return if got error for ipmi mgt --- perl-xCAT/xCAT/Usage.pm | 3 +++ xCAT-server/lib/xcat/plugins/ipmi.pm | 1 + 2 files changed, 4 insertions(+) diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 0cbba194a..049df54bd 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -26,6 +26,9 @@ my %usage = ( "rpower" => "Usage: rpower [--nodeps] [on|onstandby|off|suspend|reset|stat|state|boot] [-V|--verbose] [-m table.colum==expectedstatus][-m table.colum==expectedstatus...] [-r ] [-t ] rpower [-h|--help|-v|--version] + BMC (using IPMI) specific: + rpower noderange [on|off|softoff|reset|boot|stat|state|status|wake|suspend [-w timeout] [-o] [-r]] + rpower noderange [pduon|pduoff|pdustat] OpenBMC specific: rpower noderange [on|off|reset|boot|stat|state|status] KVM Virtualization specific: diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 00302d365..fd35a443d 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -2510,6 +2510,7 @@ sub power_response { my $text = $codes{ $rsp->{code} }; unless ($text) { $text = sprintf("Unknown response %02xh", $rsp->{code}); } xCAT::SvrUtils::sendmsg([ 1, $text ], $callback, $sessdata->{node}, %allerrornodes); + return; } else { my $command = $sessdata->{subcommand}; my $status = $sessdata->{powerstatus}; From 8826307c6ec7514c40db323c380de04544d42147 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 2 May 2017 04:13:41 -0400 Subject: [PATCH 2/4] modified depending on comments --- xCAT-server/lib/xcat/plugins/ipmi.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index fd35a443d..516ce40ee 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -2364,6 +2364,12 @@ sub power { my $rc = 0; my $text; my $code; + + if (($sessdata->{subcommand} eq "suspend" or $sessdata->{subcommand} eq "wake") and isopenpower($sessdata)) { + xCAT::SvrUtils::sendmsg([ 1, "unsupported command power $sessdata->{subcommand} for OpenPower" ], $callback, $sessdata->{node}, %allerrornodes); + return; + } + if ($sessdata->{subcommand} eq "reseat") { reseat_node($sessdata); } elsif (not $sessdata->{acpistate} and is_systemx($sessdata)) { #Only implemented for IBM servers From 7a08a2b3388f42635c41e5658d55b5dff269108c Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 2 May 2017 23:10:13 -0400 Subject: [PATCH 3/4] modified depending on comments --- .../admin-guides/references/man1/rpower.1.rst | 30 ++++++++++++++++--- perl-xCAT/xCAT/Usage.pm | 7 +++-- xCAT-client/pods/man1/rpower.1.pod | 10 +++++-- xCAT-server/lib/xcat/plugins/ipmi.pm | 2 +- 4 files changed, 40 insertions(+), 9 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rpower.1.rst b/docs/source/guides/admin-guides/references/man1/rpower.1.rst index b344f75d6..74dcc3cac 100644 --- a/docs/source/guides/admin-guides/references/man1/rpower.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rpower.1.rst @@ -23,8 +23,8 @@ SYNOPSIS \ **rpower**\ [\ **-h | -**\ **-help | -v | -**\ **-version**\ ] -BMC (using IPMI) specific: -========================== +BMC (using IPMI): +================= \ **rpower**\ \ *noderange*\ [\ **on | off | softoff | reset | boot | stat | state | status | wake | suspend**\ [\ **-w**\ \ *timeout*\ ] [\ **-o**\ ] [\ **-r**\ ]] @@ -32,8 +32,17 @@ BMC (using IPMI) specific: \ **rpower**\ \ *noderange*\ [\ **pduon | pduoff | pdustat | pdureset**\ ] -OpenBMC specific: -================= +OpenPower BMC (using IPMI): +=========================== + + +\ **rpower**\ \ *noderange*\ [\ **on | off | reset | boot | stat | state | status**\ ] + +\ **rpower**\ \ *noderange*\ [\ **pduon | pduoff | pdustat | pdureset**\ ] + + +OpenPower OpenBMC: +================== \ **rpower**\ \ *noderange*\ [\ **off | on | reset | boot | stat | state | status**\ ] @@ -97,6 +106,13 @@ Blade specific: \ **rpower**\ \ *noderange*\ [\ **cycle | softoff**\ ] +Lenovo High-Density Server specific: +==================================== + + +\ **rpower**\ \ *noderange*\ [\ **on | off | reset | boot | reseat**\ ] + + zVM specific: ============= @@ -270,6 +286,12 @@ OPTIONS +\ **reseat**\ + + For Lenovo high-density servers, simulates unplugging and replugging the node into the chassis. + + + \ **of**\ Boot the node to open firmware console mode. diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 049df54bd..0bf96db00 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -26,10 +26,13 @@ my %usage = ( "rpower" => "Usage: rpower [--nodeps] [on|onstandby|off|suspend|reset|stat|state|boot] [-V|--verbose] [-m table.colum==expectedstatus][-m table.colum==expectedstatus...] [-r ] [-t ] rpower [-h|--help|-v|--version] - BMC (using IPMI) specific: + BMC (using IPMI): rpower noderange [on|off|softoff|reset|boot|stat|state|status|wake|suspend [-w timeout] [-o] [-r]] rpower noderange [pduon|pduoff|pdustat] - OpenBMC specific: + OpenPower BMC: + rpower noderange [on|off|reset|boot|stat|state|status] + rpower noderange [pduon|pduoff|pdustat] + OpenPower OpenBMC: rpower noderange [on|off|reset|boot|stat|state|status] KVM Virtualization specific: rpower [boot] [ -c ] diff --git a/xCAT-client/pods/man1/rpower.1.pod b/xCAT-client/pods/man1/rpower.1.pod index 2a8bd9d96..61e7be87c 100644 --- a/xCAT-client/pods/man1/rpower.1.pod +++ b/xCAT-client/pods/man1/rpower.1.pod @@ -8,13 +8,19 @@ B I [B<--nodeps>] [B|B|B|B|B [B<-h>|B<--help>|B<-v>|B<--version>] -=head2 BMC (using IPMI) specific: +=head2 BMC (using IPMI): B I [B|B|B|B|B|B|B|B|B|B [B<-w> I] [B<-o>] [B<-r>]] B I [B|B|B|B] -=head2 OpenBMC specific: +=head2 OpenPower BMC (using IPMI): + +B I [B|B|B|B|B|B|B] + +B I [B|B|B|B] + +=head2 OpenPower OpenBMC: B I [B|B|B|B|B|B|B] diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 516ce40ee..b97d6d577 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -2365,7 +2365,7 @@ sub power { my $text; my $code; - if (($sessdata->{subcommand} eq "suspend" or $sessdata->{subcommand} eq "wake") and isopenpower($sessdata)) { + if (($sessdata->{subcommand} !~ /^on$|^off$|^reset$|^boot$|^stat$|^state$|^status$/) and isopenpower($sessdata)) { xCAT::SvrUtils::sendmsg([ 1, "unsupported command power $sessdata->{subcommand} for OpenPower" ], $callback, $sessdata->{node}, %allerrornodes); return; } From 5df481375644c7fa76e60fcc7cf6ece1a450302b Mon Sep 17 00:00:00 2001 From: XuWei Date: Mon, 8 May 2017 21:11:48 -0400 Subject: [PATCH 4/4] modified depending on comments --- xCAT-server/lib/xcat/plugins/ipmi.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index b97d6d577..2eb74dc35 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -2366,7 +2366,7 @@ sub power { my $code; if (($sessdata->{subcommand} !~ /^on$|^off$|^reset$|^boot$|^stat$|^state$|^status$/) and isopenpower($sessdata)) { - xCAT::SvrUtils::sendmsg([ 1, "unsupported command power $sessdata->{subcommand} for OpenPower" ], $callback, $sessdata->{node}, %allerrornodes); + xCAT::SvrUtils::sendmsg([ 1, "unsupported command rpower $sessdata->{subcommand} for OpenPower" ], $callback, $sessdata->{node}, %allerrornodes); return; }