Bug 1420302

Summary: Adding fence agent with type "invalid_type" succeeds
Product: [oVirt] ovirt-engine Reporter: Petr Matyáš <pmatyas>
Component: BLL.InfraAssignee: Martin Perina <mperina>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Matyáš <pmatyas>
Severity: low Docs Contact:
Priority: unspecified    
Version: 4.1.0CC: aslaikov, bugs, mperina, pstehlik
Target Milestone: ovirt-4.1.1Keywords: Automation
Target Release: 4.1.1.3Flags: rule-engine: ovirt-4.1+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-04-21 09:45:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Matyáš 2017-02-08 12:02:29 UTC
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):
4.1.0-12

How reproducible:
always

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>"

Actual results:
request returns 201 and the agent is added

Expected results:
request should return an error and not add the agent

Additional info:

Comment 1 Yaniv Kaul 2017-02-09 07:43:13 UTC
Why is it high severity?!

Comment 2 Juan Hernández 2017-02-09 09:42:56 UTC
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.

Comment 3 Petr Matyáš 2017-03-07 09:26:00 UTC
Verified on 4.1.1-4