Shireesh Anjal has posted comments on this change. Change subject: engine: Fix SHD service not displaying issue (#885592) ......................................................................
Patch Set 5: (6 inline comments) .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeAdvancedDetailsQuery.java Line 81: volumeAdvancedDetailsForNfs.getServiceInfo().addAll(volumeAdvancedDetailsForShd.getServiceInfo()); Line 82: getQueryReturnValue().setReturnValue(volumeAdvancedDetailsForNfs); Line 83: } else if (nfsReturnValue == null && replicateVolume != null) { Line 84: VDSReturnValue shdReturnValue = executeCommand(replicateVolume.getName()); Line 85: getQueryReturnValue().setReturnValue(shdReturnValue.getReturnValue()); The call to executeCommand() for replicateVolume is present in two places - once inside the if block, and second here. This can be avoided to moving it outside - similar to what is being done for nfsVolume. Line 86: } else if (nfsReturnValue != null && replicateVolume == null) { Line 87: getQueryReturnValue().setReturnValue(nfsReturnValue.getReturnValue()); Line 88: } Line 89: } else { Line 86: } else if (nfsReturnValue != null && replicateVolume == null) { Line 87: getQueryReturnValue().setReturnValue(nfsReturnValue.getReturnValue()); Line 88: } Line 89: } else { Line 90: VDSReturnValue returnValue = executeCommand(nfsReplicateVolume.getName()); If you put this part of the code in the "if" condition, and return inside the if condition, one level of indentation of the "else" part can be avoided. Line 91: getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); Line 92: } Line 93: Line 94: } else { Line 91: getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); Line 92: } Line 93: Line 94: } else { Line 95: VDSReturnValue returnValue = executeCommand(volumeName); Same here. Line 96: getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); Line 97: } Line 98: } Line 99: Line 110: Line 111: private GlusterVolumeEntity getReplicateVolume(Guid clusterId) { Line 112: List<GlusterVolumeEntity> replicateVolumes = getReplicateVolumes(clusterId, getReplicateVolumeTypes()); Line 113: if (replicateVolumes.size() > 0) { Line 114: return replicateVolumes.get(0); Empty line can be removed here. Line 115: } Line 116: return null; Line 117: } Line 118: Line 115: } Line 116: return null; Line 117: } Line 118: Line 119: private List<GlusterVolumeType> getReplicateVolumeTypes() { Since the replicateVolumeTypes is always the same list, it could be populated once, and kept as a class level static variable, instead of creating the list every time. Line 120: List<GlusterVolumeType> volumeTypes = new ArrayList<GlusterVolumeType>(); Line 121: volumeTypes.add(GlusterVolumeType.REPLICATE); Line 122: volumeTypes.add(GlusterVolumeType.DISTRIBUTED_REPLICATE); Line 123: return volumeTypes; Line 160: GlusterStatus.UP, Line 161: volumeTypes); Line 162: } Line 163: Line 164: private Guid getUpServerId(Guid clusterId) { This can move to the base class GlusterQueriesCommandBase, so that it can be used by other gluster queries like GetGlusterVolumeProfileInfoQuery as well. Line 165: VDS vds = getClusterUtils().getUpServer(clusterId); Line 166: if (vds == null) { Line 167: throw new RuntimeException("No up server found"); Line 168: } -- To view, visit http://gerrit.ovirt.org/10336 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id11725f44ab3fdd36f76fe569d7610a411518ee1 Gerrit-PatchSet: 5 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Dhandapani Gopal <dgo...@redhat.com> Gerrit-Reviewer: Dhandapani Gopal <dgo...@redhat.com> Gerrit-Reviewer: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com> Gerrit-Reviewer: Shireesh Anjal <san...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches