Change in ovirt-engine[master]: restapi: Validate dest when importing template

mlipchuk at redhat.com mlipchuk at redhat.com
Wed Apr 23 12:28:39 UTC 2014


Maor Lipchuk has submitted this change and it was merged.

Change subject: restapi: Validate dest when importing template
......................................................................


restapi: Validate dest when importing template

When importing a template it is mandatory to specify the destination
storage domain. The RESTAPI doesn't currently validate this, and thus
the request is accepted and eventually it generates a NPE since
AbstractBackendStorageDomainContentResource#getDestStorageDomainId is counting on the storage id.

This patch changes the RESTAPI so that it validates that the id or name of the
destination storage domain has been provided. If it isn't provided it
will generate the following error response:

  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <fault>
    <reason>Incomplete parameters</reason>
    <detail>Action [storageDomain.id|name] required for doImport</detail>
  </fault>

The patch should keep backward compatibility since before it, we got an
NPE, and now it is being replaced with an informative message.

Change-Id: I2cf2d94514b159c34f19a7f0377fcb2a9afd1c19
Bug-Url: https://bugzilla.redhat.com/1081173
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainTemplateResource.java
M backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainTemplateResourceTest.java
2 files changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Juan Hernandez: Looks good to me, but someone else must approve
  Allon Mureinik: Looks good to me, approved
  Maor Lipchuk: Verified



-- 
To view, visit http://gerrit.ovirt.org/26127
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2cf2d94514b159c34f19a7f0377fcb2a9afd1c19
Gerrit-PatchSet: 4
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: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Maor Lipchuk <mlipchuk at redhat.com>
Gerrit-Reviewer: Michael Pasternak <mishka8520 at yahoo.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the Engine-commits mailing list