[Engine-devel] REST-API: Problem with additional DELETE action at collection level
Ori Liel
oliel at redhat.com
Mon Nov 11 16:20:46 UTC 2013
Shubhendu,
The problem you're describing stems from the fact that BackendGlusterBricksResource already has an implementation of 'remove' which recieves an object (GlusterBricks). This creates ambiguity that RestEasy can't resolve: it has no way of deciding whether to deserialize the XML data into an 'Action' object or into a 'GlusterBricks' object. Within the current limitation of RestEasy, this problem is unsolvable.
To overcome this, we can take a different approach: pass 'force' as a URL matrix parameter. In order to see how this is achieved technically, I refer you to BackendResource.isAsync() method. 'async' is a URL matrix parameter, and this simple method shows how it's fetched from the URL. Implementing something similar for force should be easy.
On our side, I will deprecate all current uses of 'force' in the API and move them all to be URL matrix parameters, so that we'll be aligned with you.
Michael will be here tomorrow, and on Wednesday I'll also be available again, to help and/or review.
Thanks,
Ori.
----- Original Message -----
From: "Shubhendu Tripathi" <shtripat at redhat.com>
To: "engine-devel" <engine-devel at ovirt.org>, "Michael Pasternak" <mpastern at redhat.com>, oliel at redhat.com
Cc: "Dusmant Pati" <dpati at redhat.com>
Sent: Friday, November 8, 2013 7:59:59 AM
Subject: REST-API: Problem with additional DELETE action at collection level
Hi All,
There is a DELETE action defined at collection level for Gluster Bricks
with signature -
/@DELETE
public////Response//remove//(//GlusterBricks//bricks//);/
Recently we had needed a commit action to remove migrated bricks.
After multiple rounds of discussion on introducing a commit action to
remove migrated bricks we introduced a DELETE action [1] which accepts a
boolean parameter isForce.
If the parameter is set to /true/, forced deletion of bricks happens
without any data migration.
And if the parameter is not set or set to /false,/ the deletion is meant
for a brick on which migration has already taken place.
To achieve the above functionality we introduced another DELETE action
with new signature as below and also marked the first action as deprecated -
/@DELETE
public////Response//remove//(//Action//action//);/
The problem arises now as the new api works fine for all possible
scenarios with below input structure -
/
//<action>//
// <force>true/false</force>//
// <bricks>//
// <brick>//
// <name>//brick1-name</name>//
// <name>brick2-name</name>//
// </brick>//
// </bricks>//
//</action>/
BUT after these change backward compatibility is broken and the old api
does not work.
If we try invoking old DELETE with bricks as input parameter as below,
it still invokes the new api and gives an error saying "Invalid parameter".
/
//<bricks>
<brick id="brick1-id"/>
// <brick id="brick2-id"/>
</bricks>/
Kindly suggest a solution around the same.
*PS:* Both the actions are defined at collection level
(//api/clusters/<cluster-id>/glustervolumes/<volume-id>/bricks/)
[1]: http://gerrit.ovirt.org/#/c/21043/
Thanks and Regards,
Shubhendu
More information about the Engine-devel
mailing list