Bug #18319
closed"hammer host stop --force" power cycles virtual machine
Description
Problem Description:
Using "hammer host stop --force --id <some guest>" is power cycling the virtual machine instead of powering it off immediately.
Troubleshooting:
I was able to reproduce this on Satellite 6.2.7 and
- vSphere Version 6.0.0 Build 2997665
- RHV 4
- libvirt
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 powerdown.
To test it i replaced :cycle with :poweroff and it works fine with vmware and libvirt. On RHV4 the system does a normal shutdown.
I will create a PR for this.