Fix listing disk offerings for newly created VMs that haven't yet been started (#10476)

This commit is contained in:
Pearl Dsilva 2025-02-28 10:24:23 -05:00 committed by GitHub
parent 2d00933d65
commit bdae23ed53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -6071,6 +6071,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
@Override
public Map<Long, Boolean> getDiskOfferingSuitabilityForVm(long vmId, List<Long> diskOfferingIds) {
VMInstanceVO vm = _vmDao.findById(vmId);
if (userVmDetailsDao.findDetail(vm.getId(), VmDetailConstants.DEPLOY_VM) != null) {
return new HashMap<>();
}
VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
Pair<Long, Long> clusterAndHost = findClusterAndHostIdForVm(vm, false);
Long clusterId = clusterAndHost.first();

View File

@ -2137,7 +2137,7 @@ public class ApiDBUtils {
for (DiskOfferingJoinVO offering : offerings) {
DiskOfferingResponse response = s_diskOfferingJoinDao.newDiskOfferingResponse(offering);
if (vmId != null) {
response.setSuitableForVm(suitability.get(offering.getId()));
response.setSuitableForVm(suitability.getOrDefault(offering.getId(), true));
}
list.add(response);
}