Project

General

Profile

Actions

Bug #11642

closed

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

Added by Bryan Kearney over 8 years ago. Updated about 8 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
BMC
Target version:
-
Difficulty:
Triaged:
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 1 (0 open1 closed)

Is duplicate of Foreman - Bug #13430: virt power manager is missing reboot actionClosedTimo Goebel01/28/2016Actions
Actions #1

Updated by Dominic Cleal over 8 years ago

  • Category changed from API to BMC
Actions #2

Updated by Dominic Cleal about 8 years ago

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

Updated by Dominic Cleal about 8 years ago

  • Status changed from New to Duplicate

Fixed in #13430.

Actions

Also available in: Atom PDF