Fix NPE on scale VM operation after the corresponding template is deleted (#5736)

This commit is contained in:
Harikrishna 2021-12-01 22:23:09 +05:30 committed by GitHub
parent 965316b842
commit 4beca925d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -3990,7 +3990,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
if (currentServiceOffering.isDynamic() && !newServiceOffering.isDynamic()) {
removeCustomOfferingDetails(vmId);
}
VMTemplateVO template = _templateDao.findById(vmForUpdate.getTemplateId());
VMTemplateVO template = _templateDao.findByIdIncludingRemoved(vmForUpdate.getTemplateId());
boolean dynamicScalingEnabled = _userVmMgr.checkIfDynamicScalingCanBeEnabled(vmForUpdate, newServiceOffering, template, vmForUpdate.getDataCenterId());
vmForUpdate.setDynamicallyScalable(dynamicScalingEnabled);
return _vmDao.update(vmId, vmForUpdate);