Shubhendu Tripathi has posted comments on this change. Change subject: gluster: Added additional can do action check ......................................................................
Patch Set 1: (4 comments) .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterAsyncCommandBase.java Line 54: if (params.getBricks().isEmpty()) { Line 55: return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_BRICKS_REQUIRED); Line 56: } Line 57: Line 58: List<GlusterBrickEntity> bricksForTask = getGlusterBrickDao().getGlusterVolumeBricksByTaskId(asyncTask.getTaskId()); Would add a check for size of bricksForTask. If the same is empty would simple return true as it would be empty only in case of start remove brick. Rebalance case anyway does not end up in this piece of code. Line 59: List<GlusterBrickEntity> paramBricks = params.getBricks(); Line 60: if (paramBricks.size() != bricksForTask.size()) { Line 61: return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_PARAMS_SIZE_DOES_NOT_MATCH); Line 62: } Line 64: int counter = 0; Line 65: for (GlusterBrickEntity paramBrick : paramBricks) { Line 66: for (GlusterBrickEntity brick : bricksForTask) { Line 67: // If parameter brick directory matches with any brick no need to continue further to check Line 68: if (paramBrick.getBrickDirectory().equals(brick.getBrickDirectory())) { I feel brick directory suffices as it has host name and brick dir both. Do we need separate check for hostId as well? Line 69: break; Line 70: } Line 71: counter++; Line 72: // If the bricks list exhausted, it means the parameter brick does found, throw an error .................................................... File backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CommitRemoveGlusterVolumeBricksCommandTest.java Line 176: brick2.setBrickDirectory("/tmp/test-vol122"); Line 177: brick2.setStatus(GlusterStatus.UP); Line 178: bricks.add(brick2); Line 179: return bricks; Line 180: } Will do that Line 181: Line 182: @SuppressWarnings("unchecked") Line 183: private void mockBackend(boolean succeeded, VdcBllErrors errorCode) { Line 184: when(cmd.getBackend()).thenReturn(backend); .................................................... File backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties Line 957: ACTION_TYPE_FAILED_GLUSTER_VOLUME_NOT_DISTRIBUTED=Cannot ${action} ${type}. Gluster Volume is not distributed. Line 958: ACTION_TYPE_FAILED_GLUSTER_VOLUME_DISTRIBUTED_AND_HAS_SINGLE_BRICK=Cannot ${action} ${type}. Gluster Volume has a single brick. Line 959: ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_NOT_STARTED=Cannot ${action} ${type}. Remove brick not started. Line 960: ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_NOT_FINISHED=Cannot ${action} ${type}. Remove brick not finished. Line 961: ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_PARAMS_SIZE_DOES_NOT_MATCH=Cannot ${action} ${type}. The no of bricks does not match with the bricks used while starting the action. Will use the below one only Line 962: ACTION_TYPE_FAILED_GLUSTER_VOLUME_REMOVE_BRICKS_PARAMS_INVALID=Cannot ${action} ${type}. The list of bricks does not match with the bricks used while starting the action. Line 963: ACTION_TYPE_FAILED_NOT_A_GLUSTER_VOLUME_BRICK=Cannot ${action} ${type}. Replacing brick is not a Gluster volume brick. Line 964: ACTION_TYPE_FAILED_NO_GLUSTER_HOST_TO_PEER_PROBE=Cannot ${action} ${type}. There is no available server in the cluster to probe the new server. Line 965: ACTION_TYPE_FAILED_CAN_NOT_REDUCE_REPLICA_COUNT_MORE_THAN_ONE=Cannot ${action} ${type}. Replica count cannot be reduced by more than one. -- 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: 1 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