Bug 1417976

Summary: "hammer host stop --force" power cycles virtual machine
Product: Red Hat Satellite Reporter: Stefan Meyer <smeyer>
Component: HammerAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Ondřej Pražák <oprazak>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.7CC: bbuckingham, dhlavacd, jcallaha, mhulan, oprazak, tstrachota
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Satellite 6.2.7
Last Closed: 2018-02-21 16:51:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stefan Meyer 2017-01-31 14:20:34 UTC
Description of problem:
Using "hammer host stop --force --id <some guest>" is power cycling the virtual machine instead of powering it off immediately.


Version-Release number of selected component (if applicable):
Satellite 6.2.7

How reproducible:
Using the command "hammer host stop --force --id <some guest>" on virtual machines
running on VMware, RHV4 or libvirt

Actual results:
The virtual machine is power cycled.

Expected results:
The virtual machine is powered off immediatly.

Additional info:

Messages from production log:
2017-01-31 12:59:32 [app] [I] Started GET "/api/hosts?search=name+%3D+%22HOSTNAMEREMOVED%22" for ::1 at 2017-01-31 12:59:32 +0100
2017-01-31 12:59:32 [app] [I] Processing by Api::V2::HostsController#index as JSON
2017-01-31 12:59:32 [app] [I] Parameters: {"search"=>"name = \"HOSTNAMEREMOVED\"", "apiv"=>"v2", :host=>{}}
2017-01-31 12:59:32 [app] [I] Authorized user admin(Admin User)
2017-01-31 12:59:32 [app] [I] Rendered api/v2/hosts/index.json.rabl within api/v2/layouts/index_layout (308.6ms)
2017-01-31 12:59:32 [app] [I] Completed 200 OK in 510ms (Views: 268.4ms | ActiveRecord: 71.6ms)
2017-01-31 12:59:32 [app] [I] Started PUT "/api/hosts/274/power" for ::1 at 2017-01-31 12:59:32 +0100
2017-01-31 12:59:32 [app] [I] Processing by Api::V2::HostsController#power as JSON
2017-01-31 12:59:32 [app] [I] Parameters: {"power_action"=>"cycle", "apiv"=>"v2", "id"=>"274", :host=>{}}
2017-01-31 12:59:32 [app] [I] Authorized user admin(Admin User)
2017-01-31 12:59:34 [app] [I] Completed 200 OK in 1682ms (Views: 0.4ms | ActiveRecord: 5.7ms)

The bug seems to be in https://github.com/theforeman/hammer-cli-foreman/blob/master/lib/hammer_cli_foreman/host.rb#L324
It cycles when it should power off.

To test it I replaced :cycle with :poweroff and it works fine with vmware and libvirt. 
On RHV4, however, the virtual machine does a normal shutdown.

Comment 2 Satellite Program 2017-02-12 09:05:40 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/18319 has been resolved.

Comment 4 Ondřej Pražák 2017-08-09 12:12:12 UTC
Verified.

Sat-6.3.0 snap 10

Comment 5 Satellite Program 2018-02-21 16:51:07 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.
> 
> For information on the advisory, and where to find the updated files, follow the link below.
> 
> If the solution does not work for you, open a new bug report.
> 
> https://access.redhat.com/errata/RHSA-2018:0336