Ori Liel has posted comments on this change.

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


Patch Set 3:

(2 comments)

....................................................
File 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/gluster/BackendGlusterBricksResource.java
Line 289:                         VdcQueryType.GetGlusterVolumeById,
Line 290:                         new IdQueryParameters(asGuid(getVolumeId())),
Line 291:                         "");
Line 292: 
Line 293:         if (volume.getAsyncTask() != null && 
volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK
Ok, I agree
Line 294:                 && volume.getAsyncTask().getStatus() == 
JobExecutionStatus.FINISHED) {
Line 295:             return stopMigrate(action);
Line 296:         } else {
Line 297:             Fault fault = new Fault();


Line 295:             return stopMigrate(action);
Line 296:         } else {
Line 297:             Fault fault = new Fault();
Line 298:             
fault.setReason(localize(Messages.CANNOT_ACTIVATE_UNLESS_MIGRATION_COMPLETED));
Line 299:             throw new 
WebApplicationException(Response.status(Response.Status.BAD_REQUEST)
Status should be CONFLICT, not BAD_REQUEST. 

The separation between the two is somewhat artificial and sometimes there are 
some borderline cases, but in general. 

BAD_REQUEST - means that the request itself is corrupt, for example, a 
mandatory parameter is omitted from it. 

CONFLICT - means the request itself is OK, but it's irrelevant/infeasible *in 
the current state of things in the engine*. 

The error message we are dealing with here better fits CONFLICT than 
BAD_REQUEST.
Line 300:                     .entity(fault)
Line 301:                     .build());
Line 302:         }
Line 303:     }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifd5731b43132943a808bccae68fbcf0efaeeef89
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shubhendu Tripathi <shtri...@redhat.com>
Gerrit-Reviewer: Kanagaraj M <kmayi...@redhat.com>
Gerrit-Reviewer: Ori Liel <ol...@redhat.com>
Gerrit-Reviewer: Sahina Bose <sab...@redhat.com>
Gerrit-Reviewer: Shubhendu Tripathi <shtri...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to