Kanagaraj M has posted comments on this change.
Change subject: gluster: Command to update gluster hook on servers
......................................................................
Patch Set 1: (6 inline comments)
Frontend AppErrors.properties entry is missing.
Apart from the inline comments, the commit message and the actual logic is
contradicting.
- Commit Message talks about updating the hook content in the servers where the
content is different (Content Conflict)
- But the actual implementation copies the engine/specific server content all
other server server which doesn't have the hook at all (Missing Conflict)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/UpdateGlusterHookCommand.java
Line 61: private List<GlusterServerHook> getMissingServerHooks() {
Line 62: //get all destination servers - only serverhooks with status
missing
Line 63: List<GlusterServerHook> serverHooks = new
ArrayList<GlusterServerHook>();
Line 64: for (GlusterServerHook serverHook:
getGlusterHook().getServerHooks()) {
Line 65: if
(!serverHook.getStatus().equals(GlusterHookStatus.MISSING)) {
i think the condition should be
if(serverHook.getStatus().equals(GlusterHookStatus.MISSING))
or as simple as
if(serverHook.getStatus() == GlusterHookStatus.MISSING)
Line 66: serverHooks.add(serverHook);
Line 67: }
Line 68: }
Line 69: return serverHooks;
Line 82:
Line 83: if (getGlusterHook() == null) {
Line 84:
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_DOES_NOT_EXIST);
Line 85: return false;
Line 86: }
The above two checks can be moved to a common parent class, as the same is
repeated in GlusterHookStatusChangeCommand as well.
Line 87:
Line 88: if (getMissingServerHooks().isEmpty()) {
Line 89:
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS);
Line 90: return false;
Line 148: });
Line 149: }
Line 150:
Line 151: setSucceeded(true);
Line 152: List<Pair<GlusterServerHook, VDSReturnValue>> pairResults =
ThreadPoolUtil.invokeAll(taskList);
Its good to have an empty check for taskList
Line 153: for (Pair<GlusterServerHook, VDSReturnValue> pairResult :
pairResults) {
Line 154:
Line 155: VDSReturnValue retValue = pairResult.getSecond();
Line 156: if (!retValue.getSucceeded() ) {
Line 170: entity.setChecksum(hookChecksum);
Line 171: entity.setContent(hookContent);
Line 172: entity.setContentType(hookContentType);
Line 173: getGlusterHooksDao().updateGlusterHook(entity);
Line 174: }
How about removing the conflict flag from the hook in the DB if everything is
successful?
Line 175:
Line 176: }
Line 177:
Line 178:
....................................................
File
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/GlusterResolveHookParameters.java
Line 9: /**
Line 10: * Parameter class with Gluster cluster id, hook id as parameters. <br>
Line 11: * This will be used by enable and disable gluster hook commands. <br>
Line 12: */
Line 13: public class GlusterResolveHookParameters extends
VdcActionParametersBase {
Please rename this class to GlusterHookResolveConflictParameters
Line 14: private static final long serialVersionUID = 3398376087476446699L;
Line 15:
Line 16: @NotNull(message = "VALIDATION.GLUSTER.GLUSTER_HOOK_ID.NOT_NULL")
Line 17: private Guid hookId;
Line 17: private Guid hookId;
Line 18:
Line 19: private Guid sourceServerId;
Line 20:
Line 21: private GlusterHookStatus hookStatus;
this is not being used
Line 22:
Line 23: public GlusterResolveHookParameters(Guid hookId) {
Line 24: super();
Line 25: setHookId(hookId);
--
To view, visit http://gerrit.ovirt.org/14935
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ibccccbbed1e07d471dc472c41843f46767b9e083
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Sahina Bose <[email protected]>
Gerrit-Reviewer: Kanagaraj M <[email protected]>
Gerrit-Reviewer: Shireesh Anjal <[email protected]>
Gerrit-Reviewer: Shubhendu Tripathi <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches