Sahina Bose has posted comments on this change.
Change subject: gluster: Added additional can do action check
......................................................................
Patch Set 4:
(2 comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/gluster/GlusterBrickValidator.java
Line 101: }
Line 102:
Line 103: public ValidationResult
canStopOrCommitRemoveBrick(GlusterVolumeEntity volumeEntity,
List<GlusterBrickEntity> paramBricks) {
Line 104: GlusterAsyncTask asyncTask = volumeEntity.getAsyncTask();
Line 105: if (asyncTask != null && asyncTask.getType() ==
GlusterTaskType.REMOVE_BRICK) {
if (asyncTask == null || asyncTask.getType != GlusterTaskType.REMOVE_BRICK) {
return new ValidationResult( ...
}
can avoid the nesting of if statements this way
Line 106: if (paramBricks.isEmpty()) {
Line 107: return new
ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED);
Line 108: }
Line 109:
Line 115: int counter = 0;
Line 116: for (GlusterBrickEntity paramBrick : paramBricks) {
Line 117: for (GlusterBrickEntity brick : bricksForTask) {
Line 118: // If parameter brick directory matches with any
brick no need to continue further to check
Line 119: if
(paramBrick.getBrickDirectory().equals(brick.getBrickDirectory()) &&
paramBrick.getServerId() == brick.getServerId()) {
What if only the brick id is set in the paramBricks?
Would it be better to introduce a isBrickInList(final List<GlusterBrickEntity>
bricks, final GlusterBrickEntity searchBrick)
Line 120: break;
Line 121: }
Line 122: counter++;
Line 123: // If the bricks list exhausted, it means the
parameter brick does found, throw an error
--
To view, visit http://gerrit.ovirt.org/22353
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Id7f5d3b48985552aa5f74178008beb39ee7a06f9
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shubhendu Tripathi <[email protected]>
Gerrit-Reviewer: Kanagaraj M <[email protected]>
Gerrit-Reviewer: Omer Frenkel <[email protected]>
Gerrit-Reviewer: Sahina Bose <[email protected]>
Gerrit-Reviewer: Shubhendu Tripathi <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches