Shubhendu Tripathi has uploaded a new change for review. Change subject: restapi: Modified gluster volume rebalance action ......................................................................
restapi: Modified gluster volume rebalance action Modified the gluster volume rebalance api. The same is known as "startrebalance" now. Also there was no Task Id field in the front-end entity class. Introduced the same so that REST output gets the Task Id as well while firing the rebalance action. This Task Id could be used for further status monitoring of the task. Change-Id: Ia9fd560cc1b6a0db9cc28647bc311cb9f1b9e3b3 Signed-off-by: Shubhendu Tripathi <[email protected]> --- M backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/gluster/GlusterVolumeResource.java M backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterVolumeResource.java M backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterVolumeResourceTest.java M backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/GlusterVolumeMapper.java 5 files changed, 13 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/08/18208/1 diff --git a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/gluster/GlusterVolumeResource.java b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/gluster/GlusterVolumeResource.java index e2ad0fb..823d5fc 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/gluster/GlusterVolumeResource.java +++ b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/gluster/GlusterVolumeResource.java @@ -45,8 +45,8 @@ @Formatted @Consumes({ ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, ApiMediaType.APPLICATION_X_YAML }) @Actionable - @Path("rebalance") - public Response rebalance(Action action); + @Path("startrebalance") + public Response startRebalance(Action action); @POST @Formatted diff --git a/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd b/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd index 12e03b1..b93acc2 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd +++ b/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd @@ -3204,6 +3204,7 @@ <xs:element ref="bricks" minOccurs="0" maxOccurs="1"/> <xs:element ref="options" minOccurs="0" maxOccurs="1"/> <xs:element ref="status" minOccurs="0" maxOccurs="1"/> + <xs:element name="task_id" type="xs:string" minOccurs="0" maxOccurs="1"/> </xs:sequence> </xs:extension> </xs:complexContent> diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterVolumeResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterVolumeResource.java index c6b81b8..3519a9e 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterVolumeResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterVolumeResource.java @@ -60,7 +60,7 @@ } @Override - public Response rebalance(Action action) { + public Response startRebalance(Action action) { boolean fixLayoutOnly = (action.isSetFixLayout() ? action.isFixLayout() : false); boolean force = (action.isSetForce() ? action.isForce() : false); return doAction(VdcActionType.StartRebalanceGlusterVolume, diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterVolumeResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterVolumeResourceTest.java index 8eb8076..9817248 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterVolumeResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterVolumeResourceTest.java @@ -97,7 +97,7 @@ new String[] { "VolumeId" }, new Object[] { GUIDS[0] })); - verifyActionResponse(resource.rebalance(new Action())); + verifyActionResponse(resource.startRebalance(new Action())); } @Test diff --git a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/GlusterVolumeMapper.java b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/GlusterVolumeMapper.java index 201dd22..70e241d 100644 --- a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/GlusterVolumeMapper.java +++ b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/GlusterVolumeMapper.java @@ -65,6 +65,10 @@ } } + if(fromVolume.getTaskId() != null) { + volume.setTaskId(new Guid(fromVolume.getTaskId())); + } + return volume; } @@ -111,6 +115,10 @@ volume.setOptions(glusterOptions); } + if(fromVolume.getTaskId() != null) { + volume.setTaskId(fromVolume.getTaskId().toString()); + } + return volume; } -- To view, visit http://gerrit.ovirt.org/18208 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia9fd560cc1b6a0db9cc28647bc311cb9f1b9e3b3 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Shubhendu Tripathi <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
