shwstppr commented on code in PR #10524: URL: https://github.com/apache/cloudstack/pull/10524#discussion_r1986617957
########## server/src/main/java/org/apache/cloudstack/agent/lb/IndirectAgentLBServiceImpl.java: ########## @@ -161,29 +173,40 @@ public void propagateMSListToAgents() { List<DataCenterVO> zones = dataCenterDao.listAll(); for (DataCenterVO zone : zones) { List<Long> zoneHostIds = new ArrayList<>(); + List<Long> nonRoutingHostIds = getAllAgentBasedNonRoutingHostsFromDB(zone.getId()); + zoneHostIds.addAll(nonRoutingHostIds); Map<Long, List<Long>> clusterHostIdsMap = new HashMap<>(); List<Long> clusterIds = clusterDao.listAllClusterIds(zone.getId()); for (Long clusterId : clusterIds) { - List<Long> hostIds = getAllAgentBasedHostsFromDB(zone.getId(), clusterId); + List<Long> hostIds = getAllAgentBasedRoutingHostsFromDB(zone.getId(), clusterId); clusterHostIdsMap.put(clusterId, hostIds); zoneHostIds.addAll(hostIds); } zoneHostIds.sort(Comparator.comparingLong(x -> x)); + Long lbCheckInterval = getLBPreferredHostCheckInterval(null); + for (Long nonRoutingHostId : nonRoutingHostIds) { + setupMSList(nonRoutingHostId, zone.getId(), zoneHostIds, lbCheckInterval); + } for (Long clusterId : clusterIds) { - final Long lbCheckInterval = getLBPreferredHostCheckInterval(clusterId); + lbCheckInterval = getLBPreferredHostCheckInterval(clusterId); List<Long> hostIds = clusterHostIdsMap.get(clusterId); for (Long hostId : hostIds) { - final List<String> msList = getManagementServerList(hostId, zone.getId(), zoneHostIds); - final SetupMSListCommand cmd = new SetupMSListCommand(msList, lbAlgorithm, lbCheckInterval); - final Answer answer = agentManager.easySend(hostId, cmd); - if (answer == null || !answer.getResult()) { - logger.warn("Failed to setup management servers list to the agent of ID: {}", hostId); - } + setupMSList(hostId, zone.getId(), zoneHostIds, lbCheckInterval); } } } } + private void setupMSList(final Long hostId, final Long dcId, final List<Long> orderedHostIdList, final Long lbCheckInterval) { + final List<String> msList = getManagementServerList(hostId, dcId, orderedHostIdList); + final String lbAlgorithm = getLBAlgorithmName(); Review Comment: this is coming from a global config without a scope, we don't need to fetch it every time ########## server/src/main/java/org/apache/cloudstack/agent/lb/IndirectAgentLBServiceImpl.java: ########## @@ -161,29 +173,40 @@ public void propagateMSListToAgents() { List<DataCenterVO> zones = dataCenterDao.listAll(); for (DataCenterVO zone : zones) { List<Long> zoneHostIds = new ArrayList<>(); + List<Long> nonRoutingHostIds = getAllAgentBasedNonRoutingHostsFromDB(zone.getId()); + zoneHostIds.addAll(nonRoutingHostIds); Map<Long, List<Long>> clusterHostIdsMap = new HashMap<>(); List<Long> clusterIds = clusterDao.listAllClusterIds(zone.getId()); for (Long clusterId : clusterIds) { - List<Long> hostIds = getAllAgentBasedHostsFromDB(zone.getId(), clusterId); + List<Long> hostIds = getAllAgentBasedRoutingHostsFromDB(zone.getId(), clusterId); clusterHostIdsMap.put(clusterId, hostIds); zoneHostIds.addAll(hostIds); } zoneHostIds.sort(Comparator.comparingLong(x -> x)); + Long lbCheckInterval = getLBPreferredHostCheckInterval(null); Review Comment: this can be called once only before the zone loop with a separate variable maybe = `globalLbCheckInterval`? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org