VmwareHypervisorHost hyperHost = getHyperHost(getServiceContext());
assert(hyperHost instanceof HostMO);
VmwareManager mgr = hyperHost.getContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
VmwareHypervisorHostNetworkSummary summary = hyperHost.getHyperHostNetworkSummary(mgr.getManagementPortGroupByHost((HostMO)hyperHost));
if (summary == null) {
throw new Exception("No ESX(i) host found");
}
if (s_logger.isInfoEnabled()) {
s_logger.info("Startup report on host network info. " + _gson.toJson(summary));
}
cmd.setPrivateIpAddress(summary.getHostIp());
cmd.setPrivateNetmask(summary.getHostNetmask());
cmd.setPrivateMacAddress(summary.getHostMacAddress());
cmd.setStorageIpAddress(summary.getHostIp());
cmd.setStorageNetmask(summary.getHostNetmask());
cmd.setStorageMacAddress(summary.getHostMacAddress());
} catch (Throwable e) {
String msg = "querying host network info failed due to " + VmwareHelper.getExceptionMessage(e);
s_logger.error(msg, e);
throw new CloudRuntimeException(msg);