This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch 4.15
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.15 by this push:
new f5e665c server: NPE may cause management server to not start (#5001)
f5e665c is described below
commit f5e665cd634aaadb6316c3954e18b99c0212665f
Author: Rohit Yadav <[email protected]>
AuthorDate: Fri May 7 00:03:16 2021 +0530
server: NPE may cause management server to not start (#5001)
This NPE may happen when a VM is marked removed in the DB but not its
nics on a shared network. This can usually happen due to a failed
expunged VM or when an admin manually marks a VM as removed in DB but
does not cleanup the nics/network resources.
Signed-off-by: Rohit Yadav <[email protected]>
---
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
index 04de128..b4ef74f 100644
--- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
@@ -2232,7 +2232,7 @@ public class UserVmManagerImpl extends ManagerBase
implements UserVmManager, Vir
VMInstanceVO vmInstance =
_vmInstanceDao.findById(vmId);
// only load running vms. For stopped vms get loaded
on starting
- if (vmInstance.getState() == State.Running) {
+ if (vmInstance != null && vmInstance.getState() ==
State.Running) {
VmAndCountDetails vmAndCount = new
VmAndCountDetails(vmId, VmIpFetchTrialMax.value());
vmIdCountMap.put(nicId, vmAndCount);
}