Bug 1118329 - Can't change power management type using REST-API
Summary: Can't change power management type using REST-API
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.5.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 3.6.0
Assignee: Ori Liel
QA Contact:
URL:
Whiteboard: infra
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-10 13:00 UTC by sefi litmanovich
Modified: 2016-02-10 19:19 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-04-08 07:22:03 UTC
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description sefi litmanovich 2014-07-10 13:00:39 UTC
Description of problem:

if a power management agent is configured with agent type A and I want to change it to type B using REST-API, until now I would issue this call:

PUT request content is --  url:/api/hosts/{host_id}
 
body:

<host>
    <power_management type="apc_snmp">
        <enabled>true</enabled>
    </power_management>
</host>


Steps to Reproduce:
1.add a host.
2.enable power management and provide address, username, password and type for it.
3.try to change the type of the agent using the above call.

Actual results:

Response code = 400

fails with message:

<fault>
<reason>Operation Failed</reason>
<detail>[Cannot edit Host. Power Management is enabled for Host but no Agent type selected.]</detail>
</fault>

Expected results:

the agent type changes according to the new type.


Additional info:

This bug was found in test run:

http://jenkins.qa.lab.tlv.redhat.com:8080/job/3.5-art_rpm_build_testing/36/engine=rest,test=reg_hosts/testReport/reg_hosts.reg_host_tests/017-TestUpdatePowerManagementType;update_power_management_type/TestUpdatePowerManagementType_update_power_management_type/

Comment 1 Oved Ourfali 2014-07-16 08:23:44 UTC
A rewrite of the REST API for the power management definition is on the way.
Will be available in 3.6.
Changing the target release properly.

Comment 2 Ori Liel 2015-04-08 07:22:03 UTC
The Power-Management refactoring for 3.6 was done, among other reasons, because the old entity structure was wrong. One bad thing about the old structure was that 'type' was associated directly with 'Power-Management'. Since two agents in the same Power-Management may have different types, this doesn't make sense. Updating 'type' of the Power-Management as describes in the bug description would result in updating the type of the first agent. Since this is wrong to begin with, I see no point maintaining backwards-compatibility to it.  

The new way to update agent type is: 
  
  PUT  ...api/hosts/xxx/fenceagnets/yyy     (xxx = host-id, yyy = fence-agent id)
  <agent>
    <type>apc_snmp</type>
  </agent>


Note You need to log in before you can comment on or make changes to this bug.