Sahina Bose has uploaded a new change for review. Change subject: restapi:Remove rebalance and replace brick from API ......................................................................
restapi:Remove rebalance and replace brick from API The rebalance volume and replace brick options need to be rewritten as asynchronous gluster tasks. These options are currently not available in the UI. Removing from the API as well. Change-Id: I5ce8126324a6e9575d978cbdd136e78a6bd90626 Bug-Url: https://bugzilla.redhat.com/957602 Signed-off-by: Sahina Bose <sab...@redhat.com> --- M backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/gluster/GlusterBrickResource.java 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/rsdl_metadata.yaml M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBrickResource.java 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/BackendGlusterBrickResourceTest.java M backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterVolumeResourceTest.java 7 files changed, 2 insertions(+), 130 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/72/15872/1 diff --git a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/gluster/GlusterBrickResource.java b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/gluster/GlusterBrickResource.java index 8c3eb78..db32edb 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/gluster/GlusterBrickResource.java +++ b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/gluster/GlusterBrickResource.java @@ -1,20 +1,12 @@ package org.ovirt.engine.api.resource.gluster; -import javax.ws.rs.Consumes; import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; import org.jboss.resteasy.annotations.providers.jaxb.Formatted; -import org.ovirt.engine.api.model.Action; -import org.ovirt.engine.api.model.Actionable; import org.ovirt.engine.api.model.GlusterBrick; -import org.ovirt.engine.api.resource.ActionResource; -import org.ovirt.engine.api.resource.MeasurableResource; import org.ovirt.engine.api.resource.ApiMediaType; +import org.ovirt.engine.api.resource.MeasurableResource; /** * Resource interface for the "clusters/{cluster_id}/glustervolumes/{volume_id}/bricks/{brick_id}" resource @@ -22,23 +14,8 @@ @Produces({ ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, ApiMediaType.APPLICATION_X_YAML }) public interface GlusterBrickResource extends MeasurableResource{ - @Path("{action: (replace)}/{oid}") - public ActionResource getActionSubresource(@PathParam("action") String action, @PathParam("oid") String oid); - @GET @Formatted public GlusterBrick get(); - /** - * Replaces this brick with a new one. The property {@link Action#getNewBrick()} is required. - * - * @param action - * @return - */ - @POST - @Formatted - @Consumes({ ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, ApiMediaType.APPLICATION_X_YAML }) - @Actionable - @Path("replace") - public Response replace(Action action); -} + } 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..3d3feae 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,13 +45,6 @@ @Formatted @Consumes({ ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, ApiMediaType.APPLICATION_X_YAML }) @Actionable - @Path("rebalance") - public Response rebalance(Action action); - - @POST - @Formatted - @Consumes({ ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, ApiMediaType.APPLICATION_X_YAML }) - @Actionable @Path("setoption") public Response setOption(Action action); diff --git a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml index e0b1ef2..73e3b0a 100644 --- a/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml +++ b/backend/manager/modules/restapi/interface/definition/src/main/resources/rsdl_metadata.yaml @@ -2938,17 +2938,6 @@ headers: Content-Type: {value: application/xml|json, required: true} Correlation-Id: {value: 'any string', required: false} -- name: /api/clusters/{cluster:id}/glustervolumes/{glustervolume:id}/rebalance|rel=rebalance - request: - body: - parameterType: Action - signatures: - - mandatoryArguments: {} - optionalArguments: {action.fix_layout: 'xs:boolean', action.force: 'xs:boolean'} - urlparams: {} - headers: - Content-Type: {value: application/xml|json, required: true} - Correlation-Id: {value: 'any string', required: false} - name: /api/clusters/{cluster:id}/glustervolumes/{glustervolume:id}/setoption|rel=setoption request: body: @@ -3019,17 +3008,6 @@ - mandatoryArguments: bricks--COLLECTION: {brick.id: 'xs:string'} optionalArguments: {} - urlparams: {} - headers: - Content-Type: {value: application/xml|json, required: true} - Correlation-Id: {value: 'any string', required: false} -- name: /api/clusters/{cluster:id}/glustervolumes/{glustervolume:id}/bricks/{brick:id}/replace|rel=replace - request: - body: - parameterType: Action - signatures: - - mandatoryArguments: {action.brick.server_id: 'xs:string', action.brick.brick_dir: 'xs:string'} - optionalArguments: {action.force: 'xs:boolean'} urlparams: {} headers: Content-Type: {value: application/xml|json, required: true} diff --git a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBrickResource.java b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBrickResource.java index 0bcea2f..43e01da 100644 --- a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBrickResource.java +++ b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBrickResource.java @@ -3,20 +3,14 @@ import static org.ovirt.engine.api.restapi.resource.gluster.BackendGlusterBricksResource.SUB_COLLECTIONS; import javax.ws.rs.Path; -import javax.ws.rs.core.Response; -import org.ovirt.engine.api.model.Action; import org.ovirt.engine.api.model.GlusterBrick; import org.ovirt.engine.api.resource.StatisticsResource; import org.ovirt.engine.api.resource.gluster.GlusterBrickResource; import org.ovirt.engine.api.restapi.resource.AbstractBackendActionableResource; import org.ovirt.engine.api.restapi.resource.BackendStatisticsResource; import org.ovirt.engine.api.restapi.resource.BrickStatisticalQuery; -import org.ovirt.engine.api.restapi.types.Mapper; -import org.ovirt.engine.core.common.action.VdcActionType; -import org.ovirt.engine.core.common.action.gluster.GlusterVolumeReplaceBrickActionParameters; import org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity; -import org.ovirt.engine.core.common.businessentities.gluster.GlusterTaskOperation; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; import org.ovirt.engine.core.common.queries.IdQueryParameters; @@ -56,19 +50,6 @@ protected String getVolumeId() { return getParent().getParent().getId(); - } - - @Override - public Response replace(Action action) { - validateParameters(action, "Brick.serverId", "Brick.brickDir"); - Mapper<GlusterBrick, GlusterBrickEntity> mapper = getMapper(GlusterBrick.class, GlusterBrickEntity.class); - return doAction(VdcActionType.ReplaceGlusterVolumeBrick, - new GlusterVolumeReplaceBrickActionParameters(asGuid(getVolumeId()), - GlusterTaskOperation.START, - mapper.map(get(), null), - mapper.map(action.getBrick(), null), - action.isSetForce() ? action.isForce() : false), - action); } public BackendGlusterBricksResource getParent() { 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 0511cc9..f7d92b5 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 @@ -11,7 +11,6 @@ import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters; import org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters; -import org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters; import org.ovirt.engine.core.common.action.gluster.ResetGlusterVolumeOptionsParameters; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity; @@ -57,16 +56,6 @@ public Response stop(Action action) { return doAction(VdcActionType.StopGlusterVolume, new GlusterVolumeActionParameters(guid, action.isSetForce() ? action.isForce() : false), action); - } - - @Override - public Response rebalance(Action action) { - boolean fixLayoutOnly = (action.isSetFixLayout() ? action.isFixLayout() : false); - boolean force = (action.isSetForce() ? action.isForce() : false); - return doAction(VdcActionType.StartRebalanceGlusterVolume, - new GlusterVolumeRebalanceParameters(guid, - fixLayoutOnly, - force), action); } @Override diff --git a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBrickResourceTest.java b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBrickResourceTest.java index d87d65b..38bbbcc 100644 --- a/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBrickResourceTest.java +++ b/backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBrickResourceTest.java @@ -15,7 +15,6 @@ import javax.ws.rs.core.UriInfo; import org.junit.Test; -import org.ovirt.engine.api.model.Action; import org.ovirt.engine.api.model.Cluster; import org.ovirt.engine.api.model.GlusterBrick; import org.ovirt.engine.api.model.GlusterVolume; @@ -25,7 +24,6 @@ import org.ovirt.engine.api.restapi.resource.AbstractBackendSubResourceTest; import org.ovirt.engine.core.common.action.VdcActionParametersBase; import org.ovirt.engine.core.common.action.VdcActionType; -import org.ovirt.engine.core.common.action.gluster.GlusterVolumeReplaceBrickActionParameters; import org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity; import org.ovirt.engine.core.common.queries.IdQueryParameters; import org.ovirt.engine.core.common.queries.VdcQueryType; @@ -71,37 +69,6 @@ } catch (WebApplicationException wae) { verifyNotFoundException(wae); } - } - - @Test - public void testReplaceInvalidParams() throws Exception { - setupParentExpectations(); - setUriInfo(setUpBasicUriExpectations()); - control.replay(); - - try { - resource.replace(new Action()); - } catch (WebApplicationException wae) { - verifyIncompleteException(wae, "Action", "replace", "Brick.serverId, Brick.brickDir"); - } - } - - @Test - public void testReplace() throws Exception { - setupParentExpectations(); - setUpGetEntityExpectations(1); - setUriInfo(setUpActionExpectations(VdcActionType.ReplaceGlusterVolumeBrick, - GlusterVolumeReplaceBrickActionParameters.class, - new String[] { "VolumeId", "NewBrick.ServerId", "NewBrick.BrickDirectory" }, - new Object[] { volumeId, serverId, GlusterTestHelper.brickDir })); - resource.setParent(bricksResourceMock); - - Action action = new Action(); - action.setBrick(new GlusterBrick()); - action.getBrick().setServerId(serverId.toString()); - action.getBrick().setBrickDir(GlusterTestHelper.brickDir); - - verifyActionResponse(resource.replace(action)); } @Test 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..00db31b 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 @@ -22,7 +22,6 @@ import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters; import org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters; -import org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters; import org.ovirt.engine.core.common.action.gluster.ResetGlusterVolumeOptionsParameters; import org.ovirt.engine.core.common.businessentities.AsyncTaskStatus; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; @@ -86,18 +85,6 @@ new Object[] { GUIDS[0] })); verifyActionResponse(resource.stop(new Action())); - } - - @Test - public void testRebalance() throws Exception { - setupParentExpectations(); - resource.setParent(volumesResourceMock); - setUriInfo(setUpActionExpectations(VdcActionType.StartRebalanceGlusterVolume, - GlusterVolumeRebalanceParameters.class, - new String[] { "VolumeId" }, - new Object[] { GUIDS[0] })); - - verifyActionResponse(resource.rebalance(new Action())); } @Test -- To view, visit http://gerrit.ovirt.org/15872 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5ce8126324a6e9575d978cbdd136e78a6bd90626 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Sahina Bose <sab...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches