Shubhendu Tripathi has uploaded a new change for review.

Change subject: gluster: Run activate if remove bricks task is FINISHED
......................................................................

gluster: Run activate if remove bricks task is FINISHED

Modified to allow activate action only if the remove bricks task is
completed and currently marked as FINISHED in engine.

Change-Id: Ifd5731b43132943a808bccae68fbcf0efaeeef89
Signed-off-by: Shubhendu Tripathi <shtri...@redhat.com>
---
M 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBricksResource.java
1 file changed, 19 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/92/21292/1

diff --git 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBricksResource.java
 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBricksResource.java
index 50c8e4c..b160d3c 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBricksResource.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBricksResource.java
@@ -281,7 +281,25 @@
 
     @Override
     public Response activate(Action action) {
-        return stopMigrate(action);
+        validateParameters(action, "bricks");
+        validateBrickNames(action);
+
+        GlusterVolumeEntity volume =
+                getEntity(GlusterVolumeEntity.class,
+                        VdcQueryType.GetGlusterVolumeById,
+                        new IdQueryParameters(asGuid(getVolumeId())),
+                        "");
+
+        if (volume.getAsyncTask() != null && volume.getAsyncTask().getType() 
== GlusterTaskType.REMOVE_BRICK
+                && volume.getAsyncTask().getStatus() == 
JobExecutionStatus.FINISHED) {
+            return stopMigrate(action);
+        } else {
+            Fault fault = new Fault();
+            fault.setReason(localize(Messages.INVALID_ENUM_DETAIL));
+            throw new 
WebApplicationException(Response.status(Response.Status.BAD_REQUEST)
+                    .entity(fault)
+                    .build());
+        }
     }
 
     @Override


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifd5731b43132943a808bccae68fbcf0efaeeef89
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shubhendu Tripathi <shtri...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to