Project

General

Profile

Bug #11642

Fetching host power state using "power_action": "status" fails for VMs

Added by Bryan Kearney over 6 years ago. Updated almost 6 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
BMC
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1211376
Description of problem:
User is unable to fetch a power state of a VM using REST API `"power_action": "status"` ; PUT /api/hosts/:id/power.

Version-Release number of selected component (if applicable):
Upstream foreman 1.7.4-1
Downstream Sat 6.0.8

How reproducible:
-

Steps to Reproduce:
1. Setup a compute resource
2. Create a host on that compute resource
3. Run power state check using the rest api against the virtualized host:
[jkrocil@lysandros ~]$ curl --insecure -X PUT -d '{"power_action": "status"}' -u admin -H "Content-Type:application/json" -H "Accept:application/json" https://my-foreman.domain.com/api/v2/hosts/my-vm.nested.lan/power

Actual results: {
"error": {"message":"undefined method `status' for #<PowerManager::Virt:0x007f8e196e0268>"}
}

Expected results:
Valid response with power state info.

Additional info:
Running `"power_action": "state"` instead of "status" works.

The issue is here:
https://github.com/theforeman/foreman/blob/develop/app/services/power_manager/virt.rb#L24

"state" and "status" is being removed from the SUPPORTED_ACTIONS.
There are methods being created dynamically for each power state except the 2.
For "state" though, there is a method defined at L18.
For "status", there is nothing.

Thanks to stbenjam for help.


Related issues

Is duplicate of Foreman - Bug #13430: virt power manager is missing reboot actionClosed2016-01-28

History

#1 Updated by Dominic Cleal over 6 years ago

  • Category changed from API to BMC

#2 Updated by Dominic Cleal almost 6 years ago

  • Is duplicate of Bug #13430: virt power manager is missing reboot action added

#3 Updated by Dominic Cleal almost 6 years ago

  • Status changed from New to Duplicate

Fixed in #13430.

Also available in: Atom PDF