Kanagaraj M has posted comments on this change. Change subject: gluster: Added additional can do action check ......................................................................
Patch Set 4: (8 comments) .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/gluster/GlusterBrickValidator.java Line 111: if (paramBricks.size() != bricksForTask.size()) { Line 112: return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_PARAMS_INVALID); Line 113: } Line 114: Line 115: int counter = 0; you can have a 'found' flag 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()) { 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()) { should be .equals 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 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()) { Line 120: break; set found to true, then break Line 121: } Line 122: counter++; Line 123: // If the bricks list exhausted, it means the parameter brick does found, throw an error Line 124: if (counter == bricksForTask.size()) { Line 123: // If the bricks list exhausted, it means the parameter brick does found, throw an error Line 124: if (counter == bricksForTask.size()) { Line 125: return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_PARAMS_INVALID); Line 126: } Line 127: } if found is false, return invalid Line 128: } Line 129: } Line 130: Line 131: return ValidationResult.VALID; .................................................... File backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AbstractRemoveGlusterVolumeBricksCommandTest.java Line 56: brick2.setBrickDirectory("/tmp/test-vol122"); Line 57: brick2.setStatus(GlusterStatus.UP); Line 58: bricks.add(brick2); Line 59: return bricks; Line 60: } i dont see any difference other than the no.of.bricks in the above methods Line 61: Line 62: protected Object getvolumeWithoutRemoveBricksTask(Guid volumeId) { Line 63: GlusterVolumeEntity volume = getVolumeWithRemoveBricksTask(volumeId); Line 64: volume.getAsyncTask().setType(null); Line 58: bricks.add(brick2); Line 59: return bricks; Line 60: } Line 61: Line 62: protected Object getvolumeWithoutRemoveBricksTask(Guid volumeId) { is this method being used? Line 63: GlusterVolumeEntity volume = getVolumeWithRemoveBricksTask(volumeId); Line 64: volume.getAsyncTask().setType(null); Line 65: return volume; Line 66: } Line 97: brick.setStatus(GlusterStatus.UP); Line 98: bricks.add(brick); Line 99: } Line 100: return bricks; Line 101: } This method does the same as what above method does Line 102: Line 103: abstract protected GlusterVolumeEntity getVolumeWithRemoveBricksTask(Guid volumeId); .................................................... File backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CommitRemoveGlusterVolumeBricksCommandTest.java Line 211: assertFalse(cmd.canDoAction()); Line 212: } Line 213: Line 214: @Test Line 215: public void canDoActionFailsWithInvalidParams() { canDoActionFailsWithInvalidBricks Line 216: List<GlusterBrickEntity> paramBricks1 = getInvalidNoOfBricks(volumeWithRemoveBricksTask); Line 217: cmd = spy(new CommitRemoveGlusterVolumeBricksCommand(new GlusterVolumeRemoveBricksParameters(volumeWithRemoveBricksTask, paramBricks1))); Line 218: prepareMocks(cmd); Line 219: assertFalse(cmd.canDoAction()); -- 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 <shtri...@redhat.com> Gerrit-Reviewer: Kanagaraj M <kmayi...@redhat.com> Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com> Gerrit-Reviewer: Sahina Bose <sab...@redhat.com> Gerrit-Reviewer: Shubhendu Tripathi <shtri...@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzasl...@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