Skip to content

Commit b887841

Browse files
DaanHooglandDaan Hoogland
authored andcommitted
npe guard for get host info on vmware (apache#11054)
Co-authored-by: Daan Hoogland <[email protected]>
1 parent fe509e9 commit b887841

File tree

1 file changed

+5
-0
lines changed
  • vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo

1 file changed

+5
-0
lines changed

vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HostMO.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,11 @@ public AboutInfo getHostAboutInfo() throws Exception {
318318

319319
public VmwareHostType getHostType() throws Exception {
320320
AboutInfo aboutInfo = getHostAboutInfo();
321+
if (aboutInfo == null) {
322+
String msg = "no type info about host known, assuming ESXi";
323+
s_logger.warn(msg);
324+
return VmwareHostType.ESXi;
325+
}
321326
if ("VMware ESXi".equals(aboutInfo.getName()))
322327
return VmwareHostType.ESXi;
323328
else if ("VMware ESX".equals(aboutInfo.getName()))

0 commit comments

Comments
 (0)