This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch 4.19
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.19 by this push:
new 714b04e3a5f npe guard for get host info on vmware (#11054)
714b04e3a5f is described below
commit 714b04e3a5fec5bf0aaa6ec4d956a052cea71ab7
Author: dahn <[email protected]>
AuthorDate: Thu Jul 17 14:25:00 2025 +0200
npe guard for get host info on vmware (#11054)
Co-authored-by: Daan Hoogland <[email protected]>
---
.../src/main/java/com/cloud/hypervisor/vmware/mo/HostMO.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git
a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HostMO.java
b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HostMO.java
index 3b96e7e1999..93a471d56bb 100644
--- a/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HostMO.java
+++ b/vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HostMO.java
@@ -75,7 +75,7 @@ import com.cloud.utils.Pair;
public class HostMO extends BaseMO implements VmwareHypervisorHost {
private static final Logger s_logger = Logger.getLogger(HostMO.class);
- Map<String, VirtualMachineMO> _vmCache = new HashMap<String,
VirtualMachineMO>();
+ Map<String, VirtualMachineMO> _vmCache = new HashMap<>();
//Map<String, String> _vmInternalNameMapCache = new HashMap<String,
String>();
@@ -320,6 +320,11 @@ public class HostMO extends BaseMO implements
VmwareHypervisorHost {
public VmwareHostType getHostType() throws Exception {
AboutInfo aboutInfo = getHostAboutInfo();
+ if (aboutInfo == null) {
+ String msg = "no type info about host known, assuming ESXi";
+ s_logger.warn(msg);
+ return VmwareHostType.ESXi;
+ }
if ("VMware ESXi".equals(aboutInfo.getName()))
return VmwareHostType.ESXi;
else if ("VMware ESX".equals(aboutInfo.getName()))