Bug 1373581 - REST API v4 | Creating a NFS storage domain with invalid options will ignore them and use the defaults with no warning
Summary: REST API v4 | Creating a NFS storage domain with invalid options will ignore ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.0.4
Hardware: Unspecified
OS: Unspecified
medium
medium vote
Target Milestone: ovirt-4.0.5
: 4.0.5
Assignee: Juan Hernández
QA Contact: Carlos Mestre González
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-06 16:05 UTC by Raz Tamir
Modified: 2017-01-18 07:39 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-18 07:39:18 UTC
oVirt Team: Infra
rule-engine: ovirt-4.0.z+
mgoldboi: planning_ack+
juan.hernandez: devel_ack+
pstehlik: testing_ack+


Attachments (Terms of Use)
engine log (784.21 KB, application/x-gzip)
2016-09-06 16:05 UTC, Raz Tamir
no flags Details


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 63537 0 master MERGED restapi: Validate 'nfs_timeo' and 'nfs_retrans' range 2016-09-12 07:49:08 UTC
oVirt gerrit 63663 0 ovirt-engine-4.0 MERGED restapi: Validate 'nfs_timeo' and 'nfs_retrans' range 2016-09-13 08:14:33 UTC

Description Raz Tamir 2016-09-06 16:05:45 UTC
Created attachment 1198341 [details]
engine log

Description of problem:
When creating a NFS storage domain with invalid specific options - version, retransmission and timeout, the call from the API will ignore the invalid parameters and use the default once instead.
For example:
The API call:
POST ovirt-engine/api/storagedomains 

<storage_domain>
    <name>NFS_SD_TEST</name>
    <storage>
        <address>NFS_SERVER_IP</address>
        <nfs_retrans>131077</nfs_retrans>   <--- INVALID VALUE
        <nfs_timeo>761</nfs_timeo>
        <nfs_version>v3</nfs_version>
        <path>PATH_TO_NFS_SHARE</path>
        <type>nfs</type>
    </storage>
    <storage_format>v3</storage_format>
    <type>data</type>
    <host>
        <name>HOST_NAME</name>
    </host>
</storage_domain>

and the call in engine.log:
2016-09-06 19:00:13,967 INFO  [org.ovirt.engine.core.vdsbroker.vdsbroker.ConnectStorageServerVDSCommand] (default task-3) [393bc4a5] START, ConnectStorageServerVDSCommand(HostName = host_mixed_1, StorageServerConnectionManagementVDSParameters:{runAsync='true', hostId='5031c1d5-bdc7-441a-8f02-62c7212479ea', storagePoolId='00000000-0000-0000-0000-000000000000', storageType='NFS', connectionList='[StorageServerConnections:{id='829b6ece-c8c1-44ba-9219-26b854f1b308', connection='NFS_SERVER_IP:PATH_TO_NFS_SHARE', iqn='null', vfsType='null', mountOptions='null', nfsVersion='V3', nfsRetrans='5', nfsTimeo='761', iface='null', netIfaceName='null'}]'}), log id: 5ba5a140

The value of 'nfsRetrans' is 5


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


How reproducible:
100%

Steps to Reproduce:
1. Send a POST request to ovirt-engine/api/storagedomains with body:
<storage_domain>
    <name>NFS_SD_TEST</name>
    <storage>
        <address>NFS_SERVER_IP</address>
        <nfs_retrans>131077</nfs_retrans>   <--- INVALID VALUE
        <nfs_timeo>761</nfs_timeo>
        <nfs_version>v3</nfs_version>
        <path>PATH_TO_NFS_SHARE</path>
        <type>nfs</type>
    </storage>
    <storage_format>v3</storage_format>
    <type>data</type>
    <host>
        <name>HOST_NAME</name>
    </host>
</storage_domain>

2.
3.

Actual results:
The storage domain will be created with default retransmission of 5 and no warning shown up

Expected results:


Additional info:

Comment 1 Allon Mureinik 2016-09-07 06:10:46 UTC
Does this fail as expected in V3?

Comment 2 Allon Mureinik 2016-09-07 06:30:12 UTC
Daniel, as this week's QA contact, can you take a look please?

Comment 3 Raz Tamir 2016-09-07 07:36:43 UTC
Yes,
It does fail in v3:
Sending the same POST body in v3 and the response is:
<fault>
    <reason>Invalid value</reason>
    <detail>Value 131077 is greater than maximum unsigned short 65535</detail>
</fault>

Comment 4 Daniel Erez 2016-09-08 08:59:04 UTC
@Juan - are we perhaps using a different IntegerParser in v3? (as it seems that the error is thrown from 'IntegerParser -> parseUnsignedShort')

Comment 5 Juan Hernández 2016-09-08 10:17:28 UTC
In version 4 of the API all integers are 32 bit integers, there are no "short" integers. That means that we need to explicitly document and validate these values.

Comment 6 Juan Hernández 2016-09-08 12:56:24 UTC
The proposed patch will change the API so that it explicitly validates these values, and returns the following error response in case of failure:

  <fault>
    <reason>Value out of range</reason>
    <detail>The value 131077 of attribute 'nfs_timeio' is outside of range 0 to 65535.</detail>
  </fault>

Comment 7 Carlos Mestre González 2016-10-07 14:15:44 UTC
rhevm-4.0.5-0.1.el7ev.noarch:

<fault>
<detail>
The value 131077 of attribute 'nfs_retrans' is outside of range 0 to 65535.
</detail>
<reason>Value out of range</reason>
</fault>


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