Skip to content

Commit d182eac

Browse files
host affinity: fix vm cannot be started if a vm is stopped in the affinity group (#6936)
1 parent cf32f77 commit d182eac

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

plugins/affinity-group-processors/host-affinity/src/main/java/org/apache/cloudstack/affinity/HostAffinityProcessor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ protected Set<Long> getHostIdSet(List<Long> vmIds) {
8181
Set<Long> hostIds = new HashSet<>();
8282
for (Long groupVMId : vmIds) {
8383
VMInstanceVO groupVM = _vmInstanceDao.findById(groupVMId);
84-
hostIds.add(groupVM.getHostId());
84+
if (groupVM != null && groupVM.getHostId() != null) {
85+
hostIds.add(groupVM.getHostId());
86+
}
8587
}
8688
return hostIds;
8789
}

0 commit comments

Comments
 (0)