mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix listing disk offerings for newly created VMs that haven't yet been started (#10476)
This commit is contained in:
parent
2d00933d65
commit
bdae23ed53
@ -6071,6 +6071,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||||||
@Override
|
@Override
|
||||||
public Map<Long, Boolean> getDiskOfferingSuitabilityForVm(long vmId, List<Long> diskOfferingIds) {
|
public Map<Long, Boolean> getDiskOfferingSuitabilityForVm(long vmId, List<Long> diskOfferingIds) {
|
||||||
VMInstanceVO vm = _vmDao.findById(vmId);
|
VMInstanceVO vm = _vmDao.findById(vmId);
|
||||||
|
if (userVmDetailsDao.findDetail(vm.getId(), VmDetailConstants.DEPLOY_VM) != null) {
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
|
VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
|
||||||
Pair<Long, Long> clusterAndHost = findClusterAndHostIdForVm(vm, false);
|
Pair<Long, Long> clusterAndHost = findClusterAndHostIdForVm(vm, false);
|
||||||
Long clusterId = clusterAndHost.first();
|
Long clusterId = clusterAndHost.first();
|
||||||
|
|||||||
@ -2137,7 +2137,7 @@ public class ApiDBUtils {
|
|||||||
for (DiskOfferingJoinVO offering : offerings) {
|
for (DiskOfferingJoinVO offering : offerings) {
|
||||||
DiskOfferingResponse response = s_diskOfferingJoinDao.newDiskOfferingResponse(offering);
|
DiskOfferingResponse response = s_diskOfferingJoinDao.newDiskOfferingResponse(offering);
|
||||||
if (vmId != null) {
|
if (vmId != null) {
|
||||||
response.setSuitableForVm(suitability.get(offering.getId()));
|
response.setSuitableForVm(suitability.getOrDefault(offering.getId(), true));
|
||||||
}
|
}
|
||||||
list.add(response);
|
list.add(response);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user