Skip to content

Commit b761c27

Browse files
Exclude External hypervisor type during upgrade for System VM template checks
1 parent 9fd2b90 commit b761c27

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

engine/schema/src/main/java/com/cloud/dc/dao/ClusterDaoImpl.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,26 @@ public List<HypervisorType> getAvailableHypervisorInZone(Long zoneId) {
168168
.collect(Collectors.toList());
169169
}
170170

171+
/**
172+
* Returns distinct (HypervisorType, CPUArch) pairs from clusters in the given zone,
173+
* excluding clusters with {@link HypervisorType#External}.
174+
*
175+
* @param zoneId the zone ID to filter by, or {@code null} to include all zones
176+
* @return list of unique hypervisor type and CPU architecture pairs
177+
*/
171178
@Override
172179
public List<Pair<HypervisorType, CPU.CPUArch>> listDistinctHypervisorsArchAcrossClusters(Long zoneId) {
173180
SearchBuilder<ClusterVO> sb = createSearchBuilder();
174181
sb.select(null, Func.DISTINCT_PAIR, sb.entity().getHypervisorType(), sb.entity().getArch());
175182
sb.and("zoneId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
183+
sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.NEQ);
176184
sb.done();
177185
SearchCriteria<ClusterVO> sc = sb.create();
178186
if (zoneId != null) {
179187
sc.setParameters("zoneId", zoneId);
180188
}
189+
sc.setParameters("hypervisorType", HypervisorType.External);
190+
181191
final List<ClusterVO> clusters = search(sc, null);
182192
return clusters.stream()
183193
.map(c -> new Pair<>(c.getHypervisorType(), c.getArch()))

0 commit comments

Comments
 (0)