shwstppr commented on code in PR #10738:
URL: https://github.com/apache/cloudstack/pull/10738#discussion_r2052342083


##########
server/src/main/java/com/cloud/resource/ResourceManagerImpl.java:
##########
@@ -3266,12 +3263,16 @@ public List<HostVO> listAllHostsInAllZonesByType(final 
Type type) {
 
     @Override
     public List<HypervisorType> listAvailHypervisorInZone(final Long zoneId) {
-        List<VMTemplateVO> systemVMTemplates = 
_templateDao.listAllReadySystemVMTemplates(zoneId);
-        final Set<HypervisorType> hypervisors = new HashSet<>();
-        for (final VMTemplateVO systemVMTemplate : systemVMTemplates) {
-            hypervisors.add(systemVMTemplate.getHypervisorType());
+        final SearchCriteria<String> sc = _hypervisorsInDC.create();
+        if (zoneId != null) {
+            sc.setParameters("dataCenter", zoneId);
         }
-        return new ArrayList<>(hypervisors);
+        sc.setParameters("type", Host.Type.Routing);
+
+        return _hostDao.customSearch(sc, null).stream()

Review Comment:
   @sureshanaparti SearchBuilder used for this already has DISTINCT statement
   
https://github.com/apache/cloudstack/blob/4.20/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java#L2034



-- 
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