Change in ovirt-engine[master]: restapi: Validate 'nfs_timeo' and 'nfs_retrans' range

juan.hernandez at redhat.com juan.hernandez at redhat.com
Mon Sep 12 07:49:06 UTC 2016


Juan Hernandez has submitted this change and it was merged.

Change subject: restapi: Validate 'nfs_timeo' and 'nfs_retrans' range
......................................................................


restapi: Validate 'nfs_timeo' and 'nfs_retrans' range

Current the 'nfs_timeo' and 'nfs_retrans' values used when adding NFS
storage aren't validated, their values are just truncated and passed to
the backend. That is wrong.

As the backend receives a 'short' and the API uses an 'integer' it isn't
possible to do the validation in the backend, thus it needs to be done
in the API.

This patch changes the API so that it performs explicitly this check
before trying to do anything with the storage. If the check fails, for
example if the value of 'nfs_timeo' is 131077, the operation will fail
with error code 400 (Bad Request) and the following response body will
be returned:

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

Change-Id: I3e26b58879b2a3e0ed54fbdb9a1c70aa4efcc73c
Bug-Url: https://bugzilla.redhat.com/1373581
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/logging/Messages.java
M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainsResource.java
M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BaseBackendResource.java
M backend/manager/modules/restapi/jaxrs/src/main/resources/org/ovirt/engine/api/restapi/logging/Messages.properties
4 files changed, 28 insertions(+), 1 deletion(-)

Approvals:
  Juan Hernandez: Verified; Looks good to me, approved
  Daniel Erez: Looks good to me, but someone else must approve
  Jenkins CI: Passed CI tests
  Allon Mureinik: Looks good to me, but someone else must approve



-- 
To view, visit https://gerrit.ovirt.org/63537
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3e26b58879b2a3e0ed54fbdb9a1c70aa4efcc73c
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Daniel Erez <derez at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>



More information about the Engine-commits mailing list