From 865527400f47fb0fb79aec3c77ec2f29259e3bdb Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Tue, 21 Mar 2017 12:01:42 -0400 Subject: [PATCH] ADD support for power reset of PDU outlet --- docs/source/advanced/pdu/pdu.rst | 24 +++++- .../admin-guides/references/man1/rpower.1.rst | 4 +- .../admin-guides/references/man5/nodehm.5.rst | 2 +- .../references/man5/openbmc.5.rst | 82 +++++++++++++++++++ .../admin-guides/references/man5/passwd.5.rst | 4 +- .../admin-guides/references/man5/xcatdb.5.rst | 6 ++ .../admin-guides/references/man7/group.7.rst | 20 ++++- .../admin-guides/references/man7/node.7.rst | 20 ++++- perl-xCAT/xCAT/Usage.pm | 4 +- xCAT-client/pods/man1/rpower.1.pod | 4 +- xCAT-server/lib/perl/xCAT/PPC.pm | 2 +- xCAT-server/lib/xcat/plugins/blade.pm | 2 +- xCAT-server/lib/xcat/plugins/esx.pm | 2 +- xCAT-server/lib/xcat/plugins/hpblade.pm | 2 +- xCAT-server/lib/xcat/plugins/hpilo.pm | 2 +- xCAT-server/lib/xcat/plugins/ipmi.pm | 2 +- xCAT-server/lib/xcat/plugins/kvm.pm | 2 +- xCAT-server/lib/xcat/plugins/pdu.pm | 13 ++- xCAT-server/lib/xcat/plugins/rhevm.pm | 2 +- xCAT-server/lib/xcat/plugins/xen.pm | 2 +- xCAT-server/lib/xcat/plugins/zvm.pm | 2 +- 21 files changed, 172 insertions(+), 31 deletions(-) create mode 100644 docs/source/guides/admin-guides/references/man5/openbmc.5.rst diff --git a/docs/source/advanced/pdu/pdu.rst b/docs/source/advanced/pdu/pdu.rst index 781a7dbc9..9ed9b705c 100644 --- a/docs/source/advanced/pdu/pdu.rst +++ b/docs/source/advanced/pdu/pdu.rst @@ -63,6 +63,12 @@ The following commands are supported against a compute node: cn01: f5pdu3 outlet 6 is on cn01: f5pdu3 outlet 7 is on + * Power cycling the PDU outlets on a compute node: :: + + # rpower cn01 pdureset + cn01: f5pdu3 outlet 6 is on + cn01: f5pdu3 outlet 7 is on + The following commands are supported against a PDU: * Check the status of the full PDU: :: @@ -98,7 +104,7 @@ The following commands are supported against a PDU: f5pdu3: outlet 12 is off * Power on the full PDU: :: - + # rpower f5pdu3 on f5pdu3: outlet 1 is on f5pdu3: outlet 2 is on @@ -112,6 +118,22 @@ The following commands are supported against a PDU: f5pdu3: outlet 10 is on f5pdu3: outlet 11 is on f5pdu3: outlet 12 is on + + * Power reset the full PDU: :: + + # rpower f5pdu3 reset + f5pdu3: outlet 1 is on + f5pdu3: outlet 2 is on + f5pdu3: outlet 3 is on + f5pdu3: outlet 4 is on + f5pdu3: outlet 5 is on + f5pdu3: outlet 6 is on + f5pdu3: outlet 7 is on + f5pdu3: outlet 8 is on + f5pdu3: outlet 9 is on + f5pdu3: outlet 10 is on + f5pdu3: outlet 11 is on + f5pdu3: outlet 12 is on **Note:** For BMC based compute nodes, turning the PDU outlet power on does not automatically power on the compute side. Users will need to issue ``rpower on`` to power on the compute node after the BMC boots. 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 ca436bd30..b344f75d6 100644 --- a/docs/source/guides/admin-guides/references/man1/rpower.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rpower.1.rst @@ -29,7 +29,7 @@ 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**\ ] +\ **rpower**\ \ *noderange*\ [\ **pduon | pduoff | pdustat | pdureset**\ ] OpenBMC specific: @@ -115,7 +115,7 @@ pdu specific: ============= -\ **rpower**\ \ *noderange*\ [\ **stat | off | on**\ ] +\ **rpower**\ \ *noderange*\ [\ **stat | off | on | reset**\ ] diff --git a/docs/source/guides/admin-guides/references/man5/nodehm.5.rst b/docs/source/guides/admin-guides/references/man5/nodehm.5.rst index e3978e25e..ef568e90f 100644 --- a/docs/source/guides/admin-guides/references/man5/nodehm.5.rst +++ b/docs/source/guides/admin-guides/references/man5/nodehm.5.rst @@ -50,7 +50,7 @@ nodehm Attributes: \ **mgt**\ - The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details. + The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: openbmc, ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details. diff --git a/docs/source/guides/admin-guides/references/man5/openbmc.5.rst b/docs/source/guides/admin-guides/references/man5/openbmc.5.rst new file mode 100644 index 000000000..7e006120c --- /dev/null +++ b/docs/source/guides/admin-guides/references/man5/openbmc.5.rst @@ -0,0 +1,82 @@ + +######### +openbmc.5 +######### + +.. highlight:: perl + + +**** +NAME +**** + + +\ **openbmc**\ - a table in the xCAT database. + + +******** +SYNOPSIS +******** + + +\ **openbmc Attributes:**\ \ *node*\ , \ *bmc*\ , \ *username*\ , \ *password*\ , \ *comments*\ , \ *disable*\ + + +*********** +DESCRIPTION +*********** + + +Setting for nodes that are controlled by an on-board OpenBmc. + + +******************* +openbmc Attributes: +******************* + + + +\ **node**\ + + The node name or group name. + + + +\ **bmc**\ + + The hostname of the BMC adapter. + + + +\ **username**\ + + The BMC userid. + + + +\ **password**\ + + The BMC password. + + + +\ **comments**\ + + Any user-written notes. + + + +\ **disable**\ + + Set to 'yes' or '1' to comment out this row. + + + + +******** +SEE ALSO +******** + + +\ **nodels(1)**\ , \ **chtab(8)**\ , \ **tabdump(8)**\ , \ **tabedit(8)**\ + diff --git a/docs/source/guides/admin-guides/references/man5/passwd.5.rst b/docs/source/guides/admin-guides/references/man5/passwd.5.rst index 3438aa4b6..4123a9258 100644 --- a/docs/source/guides/admin-guides/references/man5/passwd.5.rst +++ b/docs/source/guides/admin-guides/references/man5/passwd.5.rst @@ -50,13 +50,13 @@ passwd Attributes: \ **password**\ - The default password for this type of component + The default password for this type of component. On Linux, a crypted form could be provided. Hashes starting with $1$, $5$ and $6$ (md5, sha256 and sha512 respectively) are supported. \ **cryptmethod**\ - Indicates the method that was used to encrypt the password attribute. On AIX systems, if a value is provided for this attribute it indicates that the password attribute is encrypted. If the cryptmethod value is not set it indicates the password is a simple string value. On Linux systems, the cryptmethod can be set to md5, sha256 or sha512. If not set, sha256 will be used as default. + Indicates the method to use to encrypt the password attribute. On AIX systems, if a value is provided for this attribute it indicates that the password attribute is encrypted. If the cryptmethod value is not set it indicates the password is a simple string value. On Linux systems, the cryptmethod can be set to md5, sha256 or sha512. If not set, sha256 will be used as default to encrypt plain-text passwords. diff --git a/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst b/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst index 4f8be2d93..4100de4bb 100644 --- a/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst +++ b/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst @@ -565,6 +565,12 @@ notification(5)|notification.5 +openbmc(5)|openbmc.5 + + Setting for nodes that are controlled by an on-board OpenBmc. + + + osdistro(5)|osdistro.5 Information about all the OS distros in the xCAT cluster diff --git a/docs/source/guides/admin-guides/references/man7/group.7.rst b/docs/source/guides/admin-guides/references/man7/group.7.rst index 7e42304f6..8894cc520 100644 --- a/docs/source/guides/admin-guides/references/man7/group.7.rst +++ b/docs/source/guides/admin-guides/references/man7/group.7.rst @@ -57,16 +57,24 @@ group Attributes: -\ **bmc**\ (ipmi.bmc) +\ **bmc**\ (ipmi.bmc, openbmc.bmc) + + The hostname of the BMC adapter. + + or The hostname of the BMC adapter. -\ **bmcpassword**\ (ipmi.password) +\ **bmcpassword**\ (ipmi.password, openbmc.password) The BMC password. If not specified, the key=ipmi row in the passwd table is used as the default. + or + + The BMC password. + \ **bmcport**\ (ipmi.bmcport) @@ -115,10 +123,14 @@ group Attributes: -\ **bmcusername**\ (ipmi.username) +\ **bmcusername**\ (ipmi.username, openbmc.username) The BMC userid. If not specified, the key=ipmi row in the passwd table is used as the default. + or + + The BMC userid. + \ **bmcvlantag**\ (ipmi.taggedvlan) @@ -461,7 +473,7 @@ group Attributes: \ **mgt**\ (nodehm.mgt) - The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details. + The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: openbmc, ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details. diff --git a/docs/source/guides/admin-guides/references/man7/node.7.rst b/docs/source/guides/admin-guides/references/man7/node.7.rst index f1ae11918..f375eaac0 100644 --- a/docs/source/guides/admin-guides/references/man7/node.7.rst +++ b/docs/source/guides/admin-guides/references/man7/node.7.rst @@ -69,16 +69,24 @@ node Attributes: -\ **bmc**\ (ipmi.bmc) +\ **bmc**\ (ipmi.bmc, openbmc.bmc) + + The hostname of the BMC adapter. + + or The hostname of the BMC adapter. -\ **bmcpassword**\ (ipmi.password) +\ **bmcpassword**\ (ipmi.password, openbmc.password) The BMC password. If not specified, the key=ipmi row in the passwd table is used as the default. + or + + The BMC password. + \ **bmcport**\ (ipmi.bmcport) @@ -127,10 +135,14 @@ node Attributes: -\ **bmcusername**\ (ipmi.username) +\ **bmcusername**\ (ipmi.username, openbmc.username) The BMC userid. If not specified, the key=ipmi row in the passwd table is used as the default. + or + + The BMC userid. + \ **bmcvlantag**\ (ipmi.taggedvlan) @@ -461,7 +473,7 @@ node Attributes: \ **mgt**\ (nodehm.mgt) - The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details. + The method to use to do general hardware management of the node. This attribute is used as the default if power or getmac is not set. Valid values: openbmc, ipmi, blade, hmc, ivm, fsp, bpa, kvm, esx, rhevm. See the power attribute for more details. diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index c7f7bb3ef..6d675bbe6 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -53,8 +53,8 @@ my %usage = ( docker specific: rpower noderange [start|stop|restart|pause|unpause|state] pdu specific: - rpower noderange [off|on|stat] - rpower noderange [pduoff|pduon|pdustat] + rpower noderange [off|on|stat|status|reset] + rpower noderange [pduoff|pduon|pdustat|pdustatus|pdureset] ", "rbeacon" => "Usage: rbeacon [on|off|stat] [-V|--verbose] diff --git a/xCAT-client/pods/man1/rpower.1.pod b/xCAT-client/pods/man1/rpower.1.pod index bc8a0e062..3c9b36716 100644 --- a/xCAT-client/pods/man1/rpower.1.pod +++ b/xCAT-client/pods/man1/rpower.1.pod @@ -12,7 +12,7 @@ B [B<-h>|B<--help>|B<-v>|B<--version>] 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 I [B|B|B|B] =head2 OpenBMC specific: @@ -62,7 +62,7 @@ B I [B|B|B|B|B|B =head2 pdu specific: -B I [B|B|B] +B I [B|B|B|B] =head1 DESCRIPTION diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index cfb58162c..ab2e4f072 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -235,7 +235,7 @@ sub process_command { if ($command eq 'rpower') { $subcommand = $request->{op}; } #pdu commands will be handled in the pdu plugin - if(($subcommand eq 'pduoff') || ($subcommand eq 'pduon') || ($subcommand eq 'pdustat')){ + if(($subcommand eq 'pduoff') || ($subcommand eq 'pduon') || ($subcommand eq 'pdustat') || ($subcommand eq 'pdureset')){ return 0; } diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index 5eaac006c..c202c331b 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -4401,7 +4401,7 @@ sub process_request { else { $moreinfo = build_more_info($noderange, $callback); } #pdu commands will be handled in the pdu plugin - if ($command eq "rpower" and grep(/^pduon|pduoff|pdustat$/, @exargs)) { + if ($command eq "rpower" and grep(/^pduon|pduoff|pdureset|pdustat$/, @exargs)) { return; } diff --git a/xCAT-server/lib/xcat/plugins/esx.pm b/xCAT-server/lib/xcat/plugins/esx.pm index d705ca81e..fcdb09b0c 100644 --- a/xCAT-server/lib/xcat/plugins/esx.pm +++ b/xCAT-server/lib/xcat/plugins/esx.pm @@ -407,7 +407,7 @@ sub process_request { } #pdu commands will be handled in the pdu plugin - if ($command eq "rpower" and grep(/^pduon|pduoff|pdustat$/, @exargs)) { + if ($command eq "rpower" and grep(/^pduon|pduoff|pdureset|pdustat$/, @exargs)) { return; } #my $sitetab = xCAT::Table->new('site'); diff --git a/xCAT-server/lib/xcat/plugins/hpblade.pm b/xCAT-server/lib/xcat/plugins/hpblade.pm index 090bb6738..364627ba7 100755 --- a/xCAT-server/lib/xcat/plugins/hpblade.pm +++ b/xCAT-server/lib/xcat/plugins/hpblade.pm @@ -647,7 +647,7 @@ sub process_request { else { $moreinfo = build_more_info($noderange, $callback); } #pdu commands will be handled in the pdu plugin - if ($command eq "rpower" and grep(/^pduon|pduoff|pdustat$/, @exargs)) { + if ($command eq "rpower" and grep(/^pduon|pduoff|pdureset|pdustat$/, @exargs)) { return; } diff --git a/xCAT-server/lib/xcat/plugins/hpilo.pm b/xCAT-server/lib/xcat/plugins/hpilo.pm index 72855e11a..3a88db4e3 100755 --- a/xCAT-server/lib/xcat/plugins/hpilo.pm +++ b/xCAT-server/lib/xcat/plugins/hpilo.pm @@ -362,7 +362,7 @@ sub process_request { } #pdu commands will be handled in the pdu plugin - if (($extrargs->[0] eq 'pdustat') || ($extrargs->[0] eq 'pduon') || ($extrargs->[0] eq 'pduoff')) { + if (($extrargs->[0] eq 'pdustat') || ($extrargs->[0] eq 'pdureset') || ($extrargs->[0] eq 'pduon') || ($extrargs->[0] eq 'pduoff')) { return; } diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index ae76557c1..2d86fe981 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -7682,7 +7682,7 @@ sub preprocess_request { } #pdu commands will be handled in the pdu plugin - if(($subcmd eq 'pduoff') || ($subcmd eq 'pduon') || ($subcmd eq 'pdustat')){ + if(($subcmd eq 'pduoff') || ($subcmd eq 'pduon') || ($subcmd eq 'pdustat') || ($subcmd eq 'pdureset')){ return 0; } diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index becd4c557..6e2434eea 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -3675,7 +3675,7 @@ sub process_request { } #pdu commands will be handled in the pdu plugin - if ($command eq "rpower" and grep(/^pduon|pduoff|pdustat$/, @exargs)) { + if ($command eq "rpower" and grep(/^pduon|pduoff|pdureset|pdustat$/, @exargs)) { return; } diff --git a/xCAT-server/lib/xcat/plugins/pdu.pm b/xCAT-server/lib/xcat/plugins/pdu.pm index 92d3c3350..9d54d92fc 100644 --- a/xCAT-server/lib/xcat/plugins/pdu.pm +++ b/xCAT-server/lib/xcat/plugins/pdu.pm @@ -140,7 +140,7 @@ sub process_request return powerstat($noderange, $callback); }elsif ($command eq "rpower") { my $subcmd = $exargs[0]; - if (($subcmd eq 'pduoff') || ($subcmd eq 'pduon') || ($subcmd eq 'pdustat')){ + if (($subcmd eq 'pduoff') || ($subcmd eq 'pduon') || ($subcmd eq 'pdustat')|| ($subcmd eq 'pdureset') ){ #if one day, pdu node have pdu attribute, handle in this section too return powerpduoutlet($noderange, $subcmd, $callback); } else { @@ -160,7 +160,7 @@ sub process_request } } if(@allpdunodes) { - if(($subcmd eq 'on') || ($subcmd eq 'off') || ($subcmd eq 'stat') || ($subcmd eq 'state')){ + if(($subcmd eq 'on') || ($subcmd eq 'off') || ($subcmd eq 'stat') || ($subcmd eq 'state') || ($subcmd eq 'reset') ){ return powerpdu(\@allpdunodes, $subcmd, $callback); } else { my $pdunode = join (",", @allpdunodes); @@ -232,9 +232,12 @@ sub powerpdu { if ($subcmd eq "off") { $value = 0; $statstr = "off"; - } else { + } elsif ( $subcmd eq "on") { $value = 1; $statstr = "on"; + } else { + $value = 2; + $statstr = "reset"; } for (my $outlet =1; $outlet <= $count; $outlet++) @@ -304,6 +307,10 @@ sub powerpduoutlet { $value = 1; $statstr = "on"; outletpower($session, $outlet, $value); + } elsif ($subcmd eq "pdureset") { + $value = 2; + $statstr = "reset"; + outletpower($session, $outlet, $value); } else { $callback->({ error => "$subcmd is not support"}); } diff --git a/xCAT-server/lib/xcat/plugins/rhevm.pm b/xCAT-server/lib/xcat/plugins/rhevm.pm index 5a45e7870..c2b833958 100644 --- a/xCAT-server/lib/xcat/plugins/rhevm.pm +++ b/xCAT-server/lib/xcat/plugins/rhevm.pm @@ -127,7 +127,7 @@ sub preprocess_request { } #pdu commands will be handled in the pdu plugin - if (($extraargs->[0] eq 'pdustat') || ($extraargs->[0] eq 'pduon') || ($extraargs->[0] eq 'pduoff')) { + if (($extraargs->[0] eq 'pdustat') || ($extraargs->[0] eq 'pdureset') || ($extraargs->[0] eq 'pduon') || ($extraargs->[0] eq 'pduoff')) { return; } diff --git a/xCAT-server/lib/xcat/plugins/xen.pm b/xCAT-server/lib/xcat/plugins/xen.pm index 7a552e7aa..6629f9b9f 100644 --- a/xCAT-server/lib/xcat/plugins/xen.pm +++ b/xCAT-server/lib/xcat/plugins/xen.pm @@ -706,7 +706,7 @@ sub process_request { } #pdu commands will be handled in the pdu plugin - if ($command eq "rpower" and grep(/^pduon|pduoff|pdustat$/, @exargs)) { + if ($command eq "rpower" and grep(/^pduon|pduoff|pdureset|pdustat$/, @exargs)) { return; } diff --git a/xCAT-server/lib/xcat/plugins/zvm.pm b/xCAT-server/lib/xcat/plugins/zvm.pm index 911be973e..d04a98aae 100644 --- a/xCAT-server/lib/xcat/plugins/zvm.pm +++ b/xCAT-server/lib/xcat/plugins/zvm.pm @@ -2319,7 +2319,7 @@ sub powerVM { my $out; ##pdu commands will be handled in the pdu plugin - if ($args->[0] eq 'pduon' || $args->[0] eq 'pduoff' || $args->[0] eq 'pdustat') { + if ($args->[0] eq 'pduon' || $args->[0] eq 'pdureset' || $args->[0] eq 'pduoff' || $args->[0] eq 'pdustat') { return; }