/** * Returns cached HostRuntimeInfo or get new from vCenter */ private HostRuntimeInfo getHostRuntimeInfo(String name, HostSystem host) { HostRuntimeInfo hri = hriCache.getIfPresent(name); if (hri != null) { LOG.debug("CacheHIT: HostRuntimeInfo name: " + name); return hri; } hri = host.getRuntime(); hriCache.put(name, hri); LOG.debug("CacheMISS: HostRuntimeInfo name: " + name); return hri; }
/** * Returns the maintenance state of a host */ private void getHostMaintenance(String hostName, PrintWriter out) throws IOException { try { HostSystem host = (HostSystem) getManagedEntity(hostName, "HostSystem"); Boolean is; if (host == null) { LOG.warn("No host named '" + hostName + "' found"); is = false; } else { HostRuntimeInfo hrti = host.getRuntime(); is = hrti.isInMaintenanceMode(); if (is == null) { is = false; } } out.print(is ? "1" : "0"); out.flush(); } catch (Exception ex) { LOG.error("An error occurred : " + ex.toString()); } }
intStatus = 2; } else { HostRuntimeInfo hrti = host.getRuntime(); HostSystemConnectionState hscs = hrti.getConnectionState(); if (null != hscs.name()) {
LOG.warn("No host named '" + hostName + "' found"); } else { HostRuntimeInfo hostrti = host.getRuntime(); String pState = hostrti.getPowerState().toString(); if (pState.equals("poweredOn")) {
/** * Checks whether the host system should be imported into the requisition. * * @param hostSystem the system to check * @return true for import, false otherwise */ private boolean checkHostPowerState(HostSystem hostSystem) { logger.debug("Checking power state for host system {} (ID {})", hostSystem.getName(), hostSystem.getMOR().getVal()); String powerState = hostSystem.getRuntime().getPowerState().toString(); if ("poweredOn".equals(powerState) && request.isImportHostPoweredOn()) { return true; } if ("poweredOff".equals(powerState) && request.isImportHostPoweredOff()) { return true; } if ("standBy".equals(powerState) && request.isImportHostStandBy()) { return true; } if ("unknown".equals(powerState) && request.isImportHostUnknown()) { return true; } return false; }
/** * Checks whether the host system should be imported into the requisition. * * @param hostSystem the system to check * @return true for import, false otherwise */ private boolean checkHostPowerState(HostSystem hostSystem) { logger.debug("Checking power state for host system {} (ID {})", hostSystem.getName(), hostSystem.getMOR().getVal()); String powerState = hostSystem.getRuntime().getPowerState().toString(); if ("poweredOn".equals(powerState) && request.isImportHostPoweredOn()) { return true; } if ("poweredOff".equals(powerState) && request.isImportHostPoweredOff()) { return true; } if ("standBy".equals(powerState) && request.isImportHostStandBy()) { return true; } if ("unknown".equals(powerState) && request.isImportHostUnknown()) { return true; } return false; }
if (hostSystem.getRuntime() != null) { String powerState = hostSystem.getRuntime().getPowerState().toString();
if (hostSystem.getRuntime() != null) { String powerState = hostSystem.getRuntime().getPowerState().toString();
LOG.warn("No host named '" + hostName + "' found"); } else { HostRuntimeInfo hostrti = host.getRuntime(); String pState = hostrti.getPowerState().toString(); if (pState.equals("poweredOn")) {
return PollStatus.unknown("hostSystem=null"); } else { HostRuntimeInfo hostRuntimeInfo = hostSystem.getRuntime();
return PollStatus.unknown("hostSystem=null"); } else { HostRuntimeInfo hostRuntimeInfo = hostSystem.getRuntime();
return PollStatus.unknown("hostSystem=null"); } else { HostRuntimeInfo hostRuntimeInfo = hostSystem.getRuntime(); if (hostRuntimeInfo == null) { return PollStatus.unknown("hostRuntimeInfo=null");
if (hostSystems.length > 0) { for (ManagedEntity managedEntity : hostSystems) { if ("poweredOn".equals(((HostSystem) managedEntity).getRuntime().getPowerState().toString())) { lookupMetrics("default-HostSystem" + apiVersion, managedEntity.getMOR().getVal()); break;
logger.debug("hostSystem=null"); } else { HostRuntimeInfo hostRuntimeInfo = hostSystem.getRuntime();
if (hostSystems.length > 0) { for (ManagedEntity managedEntity : hostSystems) { if ("poweredOn".equals(((HostSystem) managedEntity).getRuntime().getPowerState().toString())) { lookupMetrics("default-HostSystem" + apiVersion, managedEntity.getMOR().getVal()); break;
logger.debug("hostSystem=null"); } else { HostRuntimeInfo hostRuntimeInfo = hostSystem.getRuntime();
return PollStatus.unknown("hostSystem=null"); } else { HostRuntimeInfo hostRuntimeInfo = hostSystem.getRuntime(); if (hostRuntimeInfo == null) { return PollStatus.unknown("hostRuntimeInfo=null");
HostRuntimeInfo hostRuntimeInfo = hostSystem.getRuntime();
HostRuntimeInfo hostRuntimeInfo = hostSystem.getRuntime();