sureshanaparti commented on code in PR #10417:
URL: https://github.com/apache/cloudstack/pull/10417#discussion_r1987161568


##########
server/src/main/java/org/apache/cloudstack/agent/lb/IndirectAgentLBServiceImpl.java:
##########
@@ -342,35 +488,67 @@ public boolean migrateAgents(String fromMsUuid, long 
fromMsId, String lbAlgorith
 
         List<DataCenterVO> dataCenterList = dcDao.listAll();
         for (DataCenterVO dc : dataCenterList) {
-            Long dcId = dc.getId();
-            List<Long> orderedHostIdList = getOrderedHostIdList(dcId);
-            List<Host> agentBasedHostsOfMsInDc = 
getAllAgentBasedHostsInDc(fromMsId, dcId);
-            if (CollectionUtils.isEmpty(agentBasedHostsOfMsInDc)) {
+            List<Long> orderedHostIdList = getOrderedHostIdList(dc.getId());
+            if (!migrateNonRoutingHostAgentsInZone(fromMsUuid, fromMsId, dc, 
migrationStartTimeInMs,
+                    timeoutDurationInMs, avoidMsList, lbAlgorithm, 
lbAlgorithmChanged, orderedHostIdList)) {
+                return false;
+            }
+            List<Long> clusterIds = clusterDao.listAllClusterIds(dc.getId());
+            if (CollectionUtils.isEmpty(clusterIds)) {
                 continue;
             }
-            logger.debug(String.format("Migrating %d indirect agents from 
management server node %d (id: %s) of zone %s", agentBasedHostsOfMsInDc.size(), 
fromMsId, fromMsUuid, dc));
-            for (final Host host : agentBasedHostsOfMsInDc) {
-                long migrationElapsedTimeInMs = System.currentTimeMillis() - 
migrationStartTime;
-                if (migrationElapsedTimeInMs >= timeoutDurationInMs) {
-                    logger.debug(String.format("Stop migrating remaining 
indirect agents from management server node %d (id: %s), timed out", fromMsId, 
fromMsUuid));
+            for (Long clusterId : clusterIds) {
+                if (!migrateRoutingHostAgentsInCluster(clusterId, fromMsUuid, 
fromMsId, dc, migrationStartTimeInMs,
+                        timeoutDurationInMs, avoidMsList, lbAlgorithm, 
lbAlgorithmChanged, orderedHostIdList)) {
                     return false;
                 }
+            }
+        }

Review Comment:
   done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to