You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ha...@apache.org on 2021/11/26 06:31:48 UTC

[cloudstack] 01/01: Fix NPE on scale VM operation after the corresponding template is deleted

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

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

commit 7b73863312b643b3482202b8a053cb7b6e62bc8a
Author: Harikrishna Patnala <ha...@gmail.com>
AuthorDate: Fri Nov 26 11:59:36 2021 +0530

    Fix NPE on scale VM operation after the corresponding template is deleted
---
 .../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 0c8736b..31bc051 100755
--- a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -3808,7 +3808,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);