mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 01:32:18 +02:00
npe guard for get host info on vmware (#11054)
Co-authored-by: Daan Hoogland <dahn@apache.org>
This commit is contained in:
parent
bf46458578
commit
714b04e3a5
@ -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()))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user