use of com.emc.storageos.systemservices.exceptions.SysClientException in project coprhd-controller by CoprHD.
the class LicenseManagerImpl method getControllerCapacity.
/**
* Gets capacity from controller.
* List of returned resources include volume, file and free storage pool capacities.
*/
public ManagedResourcesCapacity getControllerCapacity() throws InternalServerErrorException {
_log.info("Getting controller capacity");
List<Service> services = _coordinator.locateAllServices(LicenseConstants.API_SVC_LOOKUP_KEY, LicenseConstants.SERVICE_LOOKUP_VERSION, null, null);
for (Service service : services) {
try {
// service could be null, if so get next service.
if (service != null) {
return getClient(service).get(SysClientFactory._URI_PROVISIONING_MANAGED_CAPACITY, ManagedResourcesCapacity.class, null);
}
} catch (SysClientException exception) {
_log.error("LicenseManager::getCapacity for Controller. Cannot connect to host: {}", service.getEndpoint().toString());
}
}
// if capacity cannot be retrieved
_log.error("Controller capacity could not be retrieved");
throw APIException.internalServerErrors.getObjectError("controller capacity", null);
}
use of com.emc.storageos.systemservices.exceptions.SysClientException in project coprhd-controller by CoprHD.
the class InternalAlertsClient method getControllerSysClient.
/**
* Returns client for active controller VMs syssvc instance.
*/
private SysClientFactory.SysClient getControllerSysClient() {
List<Service> services = coordinatorClient.locateAllServices(SYS_SVC_LOOKUP_KEY, SERVICE_LOOKUP_VERSION, null, null);
URI hostUri = null;
for (Service service : services) {
try {
// service could be null, if so get next service.
if (service != null && CONTROL_NODE_SYSSVC_ID_PATTERN.matcher(service.getId()).matches()) {
_log.info("Using {} to send alert event", service.getId());
hostUri = service.getEndpoint();
String baseNodeURL = String.format(SysClientFactory.BASE_URL_FORMAT, hostUri.getHost(), hostUri.getPort());
return SysClientFactory.getSysClient(URI.create(baseNodeURL));
}
} catch (SysClientException exception) {
_log.error("InternalAlertsClient. Cannot connect to host: {}", hostUri != null ? hostUri.toString() : "");
}
}
throw APIException.internalServerErrors.getObjectError("controller sysvsc instance", null);
}
use of com.emc.storageos.systemservices.exceptions.SysClientException in project coprhd-controller by CoprHD.
the class NodeResourceAllocationChecker method getNodeHardwareInfo.
private NodeHardwareInfoRestRep getNodeHardwareInfo(String svcId) throws SysClientException {
NodeHardwareInfoRestRep nodeHardwareInfoRestRep = null;
try {
_log.info("Get node: {} resp.", svcId);
nodeHardwareInfoRestRep = SysClientFactory.getSysClient(_coordinator.getNodeEndpointForSvcId(svcId)).get(SysClientFactory.URI_GET_INTERNAL_NODE_HARDWARE, NodeHardwareInfoRestRep.class, null);
} catch (SysClientException ex) {
_log.error("Error get node hardware info with node: {} Cause: {}", svcId, ex.getMessage());
throw ex;
}
return nodeHardwareInfoRestRep;
}
use of com.emc.storageos.systemservices.exceptions.SysClientException in project coprhd-controller by CoprHD.
the class NodeResourceAllocationChecker method getNodeResourceAllocationCheckResult.
public String getNodeResourceAllocationCheckResult() {
try {
final List<String> svcIds = _coordinator.getAllNodes();
final String mySvcId = _coordinator.getMySvcId();
NodeHardwareInfoRestRep myBaseRep = getNodeHardwareInfo(mySvcId);
for (String svcId : svcIds) {
if (!svcId.equals(mySvcId)) {
NodeHardwareInfoRestRep compareRep = getNodeHardwareInfo(svcId);
if (!check2NodesReourceAllocation(myBaseRep, compareRep)) {
return STATUS_IMBALANCE;
}
}
}
return STATUS_OK;
} catch (SysClientException ex) {
// Ignore exception
return STATUS_IMBALANCE;
}
}
use of com.emc.storageos.systemservices.exceptions.SysClientException in project coprhd-controller by CoprHD.
the class OpenSourceLicenseManagerImpl method getControllerCapacity.
/**
* Gets capacity from controller.
* List of returned resources include volume, file and free storage pool capacities.
*/
public ManagedResourcesCapacity getControllerCapacity() throws InternalServerErrorException {
_log.info("Getting controller capacity");
List<Service> services = _coordinator.locateAllServices(LicenseConstants.API_SVC_LOOKUP_KEY, LicenseConstants.SERVICE_LOOKUP_VERSION, null, null);
for (Service service : services) {
try {
// service could be null, if so get next service.
if (service != null) {
return getClient(service).get(SysClientFactory._URI_PROVISIONING_MANAGED_CAPACITY, ManagedResourcesCapacity.class, null);
}
} catch (SysClientException exception) {
_log.error("LicenseManager::getCapacity for Controller. Cannot connect to host: {}", service.getEndpoint().toString());
}
}
// if capacity cannot be retrieved
_log.error("Controller capacity could not be retrieved");
throw APIException.internalServerErrors.getObjectError("controller capacity", null);
}
Aggregations