Copilot commented on code in PR #11376: URL: https://github.com/apache/cloudstack/pull/11376#discussion_r2248111387
########## framework/agent-lb/src/main/java/org/apache/cloudstack/agent/lb/IndirectAgentLB.java: ########## @@ -48,13 +48,14 @@ public interface IndirectAgentLB { List<String> getManagementServerList(Long hostId, Long dcId, List<Long> orderedHostIdList, String lbAlgorithm); /** - * Compares received management server list against expected list for a host in a zone. + * Compares received management server list against expected list for a host in a zone and LB algorithm. * @param hostId host id * @param dcId zone id * @param receivedMSHosts received management server list - * @return true if mgmtHosts is up to date, false if not + * @param lbAlgorithm received LB algorithm + * @return true if mgmtHosts and LB algorithm are up to date, false if not */ - boolean compareManagementServerList(Long hostId, Long dcId, List<String> receivedMSHosts, String lbAlgorithm); + boolean compareManagementServerListAndLBAlorithm(Long hostId, Long dcId, List<String> receivedMSHosts, String lbAlgorithm); Review Comment: The method name contains a typo: 'LBAlorithm' should be 'LBAlgorithm'. ```suggestion boolean compareManagementServerListAndLBAlgorithm(Long hostId, Long dcId, List<String> receivedMSHosts, String lbAlgorithm); ``` ########## engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java: ########## @@ -1357,29 +1363,34 @@ private AgentAttache sendReadyAndGetAttache(HostVO host, ReadyCommand ready, Lin ready.setArch(host.getArch().getType()); AgentAttache attache; GlobalLock joinLock = getHostJoinLock(host.getId()); - if (joinLock.lock(60)) { - try { + try { + if (!joinLock.lock(60)) { + throw new ConnectionException(true, String.format("Unable to acquire lock on host %s, to process agent connection", host)); + } - if (!indirectAgentLB.compareManagementServerList(host.getId(), host.getDataCenterId(), agentMSHostList, lbAlgorithm)) { + logger.debug("Acquired lock on host {}, to process agent connection", host); + try { + if (!indirectAgentLB.compareManagementServerListAndLBAlorithm(host.getId(), host.getDataCenterId(), agentMSHostList, lbAlgorithm)) { Review Comment: The method name contains a typo: 'LBAlorithm' should be 'LBAlgorithm'. ```suggestion if (!indirectAgentLB.compareManagementServerListAndLBAlgorithm(host.getId(), host.getDataCenterId(), agentMSHostList, lbAlgorithm)) { ``` ########## server/src/main/java/org/apache/cloudstack/agent/lb/IndirectAgentLBServiceImpl.java: ########## @@ -149,7 +149,7 @@ public List<String> getManagementServerList(final Long hostId, final Long dcId, } @Override - public boolean compareManagementServerList(final Long hostId, final Long dcId, final List<String> receivedMSHosts, final String lbAlgorithm) { + public boolean compareManagementServerListAndLBAlorithm(final Long hostId, final Long dcId, final List<String> receivedMSHosts, final String lbAlgorithm) { Review Comment: The method name contains a typo: 'LBAlorithm' should be 'LBAlgorithm'. ```suggestion public boolean compareManagementServerListAndLBAlgorithm(final Long hostId, final Long dcId, final List<String> receivedMSHosts, final String lbAlgorithm) { ``` -- 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