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/
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.
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>