From 1fe34083b67a3f755c2b4de5c651c45af3fc6200 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 10 Jul 2017 16:18:03 -0400 Subject: [PATCH] Initial commit to support rpower softoff for openbmc --- .../guides/admin-guides/references/man1/rpower.1.rst | 2 +- xCAT-client/pods/man1/rpower.1.pod | 2 +- xCAT-server/lib/xcat/plugins/openbmc.pm | 10 +++++++++- 3 files changed, 11 insertions(+), 3 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 414471bd5..243d10b19 100644 --- a/docs/source/guides/admin-guides/references/man1/rpower.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rpower.1.rst @@ -45,7 +45,7 @@ OpenPOWER OpenBMC: ================== -\ **rpower**\ \ *noderange*\ [\ **off | on | reset | boot | stat | state | status**\ ] +\ **rpower**\ \ *noderange*\ [\ **off | on | softoff | reset | boot | stat | state | status**\ ] PPC (with IVM or HMC) specific: diff --git a/xCAT-client/pods/man1/rpower.1.pod b/xCAT-client/pods/man1/rpower.1.pod index 0e38e78c8..9112ff250 100644 --- a/xCAT-client/pods/man1/rpower.1.pod +++ b/xCAT-client/pods/man1/rpower.1.pod @@ -22,7 +22,7 @@ B I [B|B|B|B] =head2 OpenPOWER OpenBMC: -B I [B|B|B|B|B|B|B] +B I [B|B|B|B|B|B|B|B] =head2 PPC (with IVM or HMC) specific: diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index eae17d85f..61be2577a 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -168,6 +168,11 @@ my %status_info = ( RPOWER_OFF_RESPONSE => { process => \&rpower_response, }, + RPOWER_SOFTOFF_REQUEST => { + method => "PUT", + init_url => "$openbmc_project_url/state/host0/attr/RequestedHostTransition", + data => "xyz.openbmc_project.State.Host.Transition.Off", + }, RPOWER_RESET_REQUEST => { method => "PUT", init_url => "$openbmc_project_url/state/host0/attr/RequestedHostTransition", @@ -441,7 +446,7 @@ sub parse_args { } if ($command eq "rpower") { - unless ($subcommand =~ /^on$|^off$|^reset$|^boot$|^status$|^stat$|^state$/) { + unless ($subcommand =~ /^on$|^off$|^softoff$|^reset$|^boot$|^status$|^stat$|^state$/) { return ([ 1, "Unsupported command: $command $subcommand" ]); } } elsif ($command eq "rinv") { @@ -566,6 +571,9 @@ sub parse_command_status { } elsif ($subcommand eq "off") { $next_status{LOGIN_RESPONSE} = "RPOWER_OFF_REQUEST"; $next_status{RPOWER_OFF_REQUEST} = "RPOWER_OFF_RESPONSE"; + } elsif ($subcommand eq "softoff") { + $next_status{LOGIN_RESPONSE} = "RPOWER_SOFTOFF_REQUEST"; + $next_status{RPOWER_SOFTOFF_REQUEST} = "RPOWER_OFF_RESPONSE"; } elsif ($subcommand eq "reset") { $next_status{LOGIN_RESPONSE} = "RPOWER_RESET_REQUEST"; $next_status{RPOWER_RESET_REQUEST} = "RPOWER_RESET_RESPONSE";