Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -3266,12 +3266,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()
// The search is not able to return list of enums, so getting
// list of hypervisors as strings and then converting them to enum
.map(HypervisorType::getType).collect(Collectors.toList());
}

@Override
Expand Down
Loading