This is an automated email from the ASF dual-hosted git repository.

weizhou pushed a commit to branch 4.16
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.16 by this push:
     new 4beca92  Fix NPE on scale VM operation after the corresponding 
template is deleted (#5736)
4beca92 is described below

commit 4beca925d7e3bbab2e5611146d6a8d88133925a2
Author: Harikrishna <[email protected]>
AuthorDate: Wed Dec 1 22:23:09 2021 +0530

    Fix NPE on scale VM operation after the corresponding template is deleted 
(#5736)
---
 .../src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
 
b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
index 1bba582..42cdb88 100755
--- 
a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
+++ 
b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -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);

Reply via email to