Bug #18319

"hammer host stop --force" power cycles virtual machine

Added by Stefan Meyer 12 months ago. Updated 11 months ago.

Status:Closed
Priority:Normal
Assigned To:-
Category:Hammer core
Target version:Foreman - Team Marek Iteration 9
Difficulty:trivial Bugzilla link:1417976
Found in release:1.11.0 Pull request:https://github.com/theforeman/hammer-cli-foreman/pull/280
Story points-
Velocity based estimate-
Releasehammer-cli-foreman-0.10.0Release relationshipAuto

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.

Associated revisions

Revision a6b419c9
Added by Stefan Meyer 12 months ago

Fixes #18319 - poweroff hosts when using --force option

History

#1 Updated by The Foreman Bot 12 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/hammer-cli-foreman/pull/280 added

#2 Updated by Tomáš Strachota 12 months ago

  • Bugzilla link set to 1417976

#3 Updated by Tomáš Strachota 12 months ago

  • Target version set to Team Marek Iteration 9

#4 Updated by Stefan Meyer 12 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#5 Updated by Tomáš Strachota 11 months ago

  • Release set to hammer-cli-foreman-0.10.0

Also available in: Atom PDF