Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1442056

Summary: Missing validation of option parameters for fence agents when using REST API
Product: [oVirt] ovirt-engine Reporter: Petr Matyáš <pmatyas>
Component: BLL.InfraAssignee: Eli Mesika <emesika>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Matyáš <pmatyas>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.1.1CC: bugs, lsvaty, mperina, oourfali
Target Milestone: ovirt-4.2.0Keywords: Automation
Target Release: 4.2.0Flags: rule-engine: ovirt-4.2+
lsvaty: testing_ack+
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-12-20 11:17:10 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:
Attachments:
Description Flags
engine log none

Description Petr Matyáš 2017-04-13 12:18:21 UTC
Created attachment 1271421 [details]
engine log

Description of problem:
There is no validation of option parameters of fence agents through RESTApi, though there is a validation for these options when you edit them in UI.

Eg. You can't add a fence agent with option port=rhv01 through UI (bz 1375646), but when you do the same with RESTApi, you have new fence agent with invalid parameter, which shows only in RESTApi and not in UI.

Version-Release number of selected component (if applicable):
4.1.1-9

How reproducible:
always

Steps to Reproduce:
1. CREATE request content is --  url:/ovirt-engine/api/hosts/$HOST_ID/fenceagents body:<agent>
    <address>$ADDRESS</address>
    <concurrent>false</concurrent>
    <options>
        <option>
            <name>port</name>
            <value>rhv01</value>
        </option>
    </options>
    <order>1</order>
    <password>$PASSWORD</password>
    <type>ipmilan</type>
    <username>$USERNAME</username>
</agent>

Actual results:
GET request content is --  url:/ovirt-engine/api/hosts/$HOST_ID/fenceagents 
<agents>
    <agent href="/ovirt-engine/api/hosts/$HOST_ID/fenceagents/$AGENT_ID" id="$AGENT_ID">
        <address>$ADDRESS</address>
        <encrypt_options>false</encrypt_options>
        <options>
            <option>
                <name>port</name>
                <value>rhv01</value>
            </option>
        </options>
        <order>1</order>
        <password>$PASSWORD</password>
        <type>ipmilan</type>
        <username>$USERNAME</username>
        <host href="/ovirt-engine/api/hosts/$HOST_ID" id="$HOST_ID"/>
    </agent>
</agents>

Expected results:
adding should not succeed

Additional info:

Comment 1 Juan Hernández 2017-04-17 07:24:53 UTC
The API doesn't perform this kind of validations, therefore moving to the backend component.

Comment 2 Petr Matyáš 2017-07-17 11:28:10 UTC
Verified on ovirt-engine-4.2.0-0.0.master.20170716234133.git58bf684.el7.centos.noarch

Comment 3 Sandro Bonazzola 2017-12-20 11:17:10 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.