use of com.emc.storageos.coordinator.common.Service in project coprhd-controller by CoprHD.
the class HostSupplierImpl method internalGet.
public List<Host> internalGet() {
try {
_log.debug("getting hosts for " + dbSvcName + "; version = " + _version);
boolean isGeodb = Constants.GEODBSVC_NAME.equals(dbSvcName);
List<Service> service = _coordinator.locateAllServices(dbSvcName, _version, (String) null, null);
List<Host> hostList = new ArrayList<Host>(service.size());
for (int i = 0; i < service.size(); i++) {
Service svc = service.get(i);
if (isGeodb && isDbReinitializing(svc)) {
_log.debug("Ignore host {} because its geodb is reinitialzing", svc.getId());
continue;
}
URI hostUri = svc.getEndpoint();
_log.debug("Found " + svc.getName() + "; host = " + hostUri.getHost() + "; port = " + hostUri.getPort());
hostList.add(new Host(String.format("%1$s:%2$d", hostUri.getHost(), hostUri.getPort()), hostUri.getPort()));
}
_log.debug("dbsvc endpoint refreshed");
return hostList;
} catch (RetryableCoordinatorException e) {
_log.warn("no dbsvc instance running. Coordinator exception message: {}", e.getMessage());
} catch (Exception e) {
_log.error("dbsvc lookup failure", e);
}
return Collections.emptyList();
}
use of com.emc.storageos.coordinator.common.Service in project coprhd-controller by CoprHD.
the class GeoSeedProviderImpl method getStartedGeodbsvcList.
private List<String> getStartedGeodbsvcList() {
List<String> geodbsvcIds = new ArrayList<String>();
try {
final String schemaVersion = coordinator.getCurrentDbSchemaVersion();
final List<Service> serviceList = coordinator.locateAllServices(Constants.GEODBSVC_NAME, schemaVersion, (String) null, null);
for (Service getdbsvc : serviceList) {
geodbsvcIds.add(getdbsvc.getId());
}
log.info("Geodbsvc started status: {}", geodbsvcIds);
} catch (Exception ex) {
log.warn("Check geodbsvc beacon error", ex);
}
return geodbsvcIds;
}
use of com.emc.storageos.coordinator.common.Service in project coprhd-controller by CoprHD.
the class BackupOps method getAvailableNodes.
private List<String> getAvailableNodes() {
List<String> goodNodes = new ArrayList<String>();
try {
List<Service> svcs = coordinatorClient.locateAllServices(((CoordinatorClientImpl) coordinatorClient).getSysSvcName(), ((CoordinatorClientImpl) coordinatorClient).getSysSvcVersion(), (String) null, null);
for (Service svc : svcs) {
String svcId = svc.getId();
String nodeId = String.format(Constants.NODE_ID_FORMAT, svcId.substring(svcId.lastIndexOf("-") + 1));
if (svcId.endsWith(Constants.STANDALONE_ID)) {
nodeId = Constants.STANDALONE_ID;
}
goodNodes.add(nodeId);
}
log.debug("Available nodes: {}", goodNodes);
} catch (Exception e) {
log.warn("Failed to get available nodes by query syssvc beacon", e);
goodNodes.addAll(hosts.keySet());
}
return goodNodes;
}
Aggregations