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
Next Next commit
Exclude External hypervisor type during upgrade for System VM templat…
…e checks
  • Loading branch information
harikrishna-patnala committed Aug 12, 2025
commit b761c27cafabaf802ec156fe9279ed90d2893399
10 changes: 10 additions & 0 deletions engine/schema/src/main/java/com/cloud/dc/dao/ClusterDaoImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,26 @@ public List<HypervisorType> getAvailableHypervisorInZone(Long zoneId) {
.collect(Collectors.toList());
}

/**
* Returns distinct (HypervisorType, CPUArch) pairs from clusters in the given zone,
* excluding clusters with {@link HypervisorType#External}.
*
* @param zoneId the zone ID to filter by, or {@code null} to include all zones
* @return list of unique hypervisor type and CPU architecture pairs
*/
@Override
public List<Pair<HypervisorType, CPU.CPUArch>> listDistinctHypervisorsArchAcrossClusters(Long zoneId) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel the method name should reflect the change to avoid confusion and wrong usage

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shwstppr can you check the new changes with name change

SearchBuilder<ClusterVO> sb = createSearchBuilder();
sb.select(null, Func.DISTINCT_PAIR, sb.entity().getHypervisorType(), sb.entity().getArch());
sb.and("zoneId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.NEQ);
sb.done();
SearchCriteria<ClusterVO> sc = sb.create();
if (zoneId != null) {
sc.setParameters("zoneId", zoneId);
}
sc.setParameters("hypervisorType", HypervisorType.External);

final List<ClusterVO> clusters = search(sc, null);
return clusters.stream()
.map(c -> new Pair<>(c.getHypervisorType(), c.getArch()))
Expand Down
Loading