Sahina Bose has posted comments on this change. Change subject: engine:Sync gluster hooks ......................................................................
Patch Set 2: (7 inline comments) Patchset to follow .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterHookManager.java Line 35: Line 36: @OnTimerMethodAnnotation("refreshHooks") Line 37: public void refreshHooks() { Line 38: log.debug("Refreshing hooks list"); Line 39: List<VDSGroup> clusters = getClusterDao().getAll(); Yes, good point - will add compat check for glusterHookFeature and supports gluster check Line 40: Line 41: for (VDSGroup cluster : clusters) { Line 42: List<VDS> upServers = getClusterUtils().getAllUpServers(cluster.getId()); Line 43: Line 72: Map<HookKey, GlusterHookEntity> hooksWithConflictChanges = new HashMap<HookKey,GlusterHookEntity>(); Line 73: Line 74: for (Pair<VDS, VDSReturnValue> pairResult : pairResults) { Line 75: VDS server = pairResult.getFirst(); Line 76: List<GlusterHookEntity> returnedHooks = (List<GlusterHookEntity>) pairResult.getSecond().getReturnValue(); Right, will add a getSucceeded check Line 77: Line 78: for (GlusterHookEntity retHook: returnedHooks) { Line 79: HookKey key= HookKey.valueOf(retHook.getGlusterCommand(),retHook.getStage(),retHook.getName()); Line 80: GlusterHookEntity existingHook = existingHookMap.get(key); Line 78: for (GlusterHookEntity retHook: returnedHooks) { Line 79: HookKey key= HookKey.valueOf(retHook.getGlusterCommand(),retHook.getStage(),retHook.getName()); Line 80: GlusterHookEntity existingHook = existingHookMap.get(key); Line 81: Line 82: addToReturnedHookKeyList(returnedHookKeyList, retHook); Done Line 83: Line 84: if (existingHook != null) { Line 85: GlusterServerHook serverHook = getServerHookForServer(existingHook, server); Line 86: // if gsh null, insert serverhook Line 82: addToReturnedHookKeyList(returnedHookKeyList, retHook); Line 83: Line 84: if (existingHook != null) { Line 85: GlusterServerHook serverHook = getServerHookForServer(existingHook, server); Line 86: // if gsh null, insert serverhook refactoring name did not change comment :) Line 87: if (serverHook == null) { Line 88: log.infoFormat("Adding new server hook {0} in server {1} ", key,server); Line 89: newServerHooks.add(buildServerHook(server.getId(), existingHook.getId(), retHook)); Line 90: } else { Line 98: } Line 99: Line 100: } Line 101: Integer oldConflictValue = existingHook.getConflictStatus(); Line 102: existingHook = setConflict(existingHook, retHook); All conflicts are ORed. so the resultant hook entity conflict value, will be superset of conflicts Line 103: if (!oldConflictValue.equals(existingHook.getConflictStatus())) { Line 104: log.debugFormat("Conflict change detected for hook {0} in server {1} ", key,server); Line 105: if (hooksWithConflictChanges.containsKey(key)) { Line 106: existingHook.setConflictStatus(existingHook.getConflictStatus() | hooksWithConflictChanges.get(key).getConflictStatus()); Line 105: if (hooksWithConflictChanges.containsKey(key)) { Line 106: existingHook.setConflictStatus(existingHook.getConflictStatus() | hooksWithConflictChanges.get(key).getConflictStatus()); Line 107: } Line 108: hooksWithConflictChanges.put(key, existingHook); Line 109: } I would prefer to leave it as it is. The admin can intervene and check what needs to be done in these cases Line 110: } else { Line 111: log.infoFormat("Adding new hook {0} in server {1} ", key,server); Line 112: existingHook = newHookMap.get(key); Line 113: if (existingHook == null) { Line 116: } Line 117: GlusterServerHook gsh = buildServerHook(server.getId(), existingHook.getId(), retHook); Line 118: existingHook.getServerHooks().add(gsh); Line 119: existingHook = setConflict(existingHook, retHook); Line 120: newHookMap.put(key, existingHook); the newhook map gets updated from each server's return value..so needs to be here, I think Line 121: } Line 122: } Line 123: } Line 124: -- To view, visit http://gerrit.ovirt.org/13943 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2766edd4e810677a200cf5c45d334cabef5f2924 Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Sahina Bose <sab...@redhat.com> Gerrit-Reviewer: Kanagaraj M <kmayi...@redhat.com> Gerrit-Reviewer: Sahina Bose <sab...@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