Description of problem:
When adding fence agents I'm able to add fence agent with wrong type (e.g. "invalid_type"), the request succeeds, but it's unable to activate it with error Cannot edit Host. Selected Power Management Agent is not supported.
This error should be thrown when adding the agent, checking it upon activation is too late.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. have engine with some host which has PM
2. curl -v -u "$USERNAME@$DOMAIN:$PASSWORD" -H "Content-type: application/xml" --insecure -X POST https://$HOSTNAME/ovirt-engine/api/hosts/$HOSTID/fenceagents -d "<agent><address>$AGENT_ADDRESS</address><concurrent>false</concurrent><order>1</order><password>$AGENT_PASSWORD</password><type>invalid_type</type><username>$AGENT_USERNAME</username></agent>"
request returns 201 and the agent is added
request should return an error and not add the agent
Why is it high severity?!
The API does not do this kind of validation, it just sends to the backend the 'type' provided by the caller. If this needs to be validated and rejected, then it should be done in the backend.
Verified on 4.1.1-4