use of com.emc.storageos.coordinator.common.Service in project coprhd-controller by CoprHD.
the class CoordinatorClientImpl method locateService.
@Override
public <T> T locateService(Class<T> clazz, String name, String version, String tag, String endpointKey) throws CoordinatorException {
String key = String.format("%1$s:%2$s:%3$s:%4$s", name, version, tag, endpointKey);
Object proxy = _proxyCache.get(key);
if (proxy == null) {
List<Service> services = locateAllServices(name, version, tag, endpointKey);
if (services == null || services.isEmpty()) {
throw CoordinatorException.retryables.unableToLocateService(name, version, tag, endpointKey);
}
Service service = services.get(0);
URI endpoint = service.getEndpoint(endpointKey);
if (endpoint == null) {
throw CoordinatorException.retryables.unableToLocateServiceNoEndpoint(name, version, tag, endpointKey);
}
// check local host IPv6/IPv4
endpoint = getInetAddessLookupMap().expandURI(endpoint);
if (endpoint.getScheme().equals("rmi")) {
RmiInvocationHandler handler = new RmiInvocationHandler();
handler.setName(name);
handler.setVersion(version);
handler.setTag(tag);
handler.setEndpointKey(endpointKey);
handler.setEndpointInterface(clazz);
handler.setCoordinator(this);
proxy = Proxy.newProxyInstance(clazz.getClassLoader(), new Class[] { clazz }, handler);
_proxyCache.putIfAbsent(key, proxy);
} else {
throw CoordinatorException.retryables.unsupportedEndPointSchema(endpoint.getScheme());
}
}
return clazz.cast(proxy);
}
use of com.emc.storageos.coordinator.common.Service in project coprhd-controller by CoprHD.
the class CoordinatorClientImpl method getDifferentVdcConfigVersionCommon.
/**
* Common method to compare vdcConfigVersions with target's vdcConfigVersion
*
* @param vdcConfigVersions
* nodes' vdcConfigVersions
* @return list of nodes which configVersions are different from the target's
*/
private List<String> getDifferentVdcConfigVersionCommon(final Map<Service, VdcConfigVersion> vdcConfigVersions) {
List<String> differentConfigVersions = new ArrayList<String>();
SiteInfo targetSiteInfo = getTargetInfo(SiteInfo.class);
if (targetSiteInfo == null) {
return differentConfigVersions;
}
String targetVdcConfigVersion = String.valueOf(targetSiteInfo.getVdcConfigVersion());
for (Map.Entry<Service, VdcConfigVersion> entry : vdcConfigVersions.entrySet()) {
if (!StringUtils.equals(targetVdcConfigVersion, entry.getValue().getConfigVersion())) {
differentConfigVersions.add(entry.getKey().getId());
}
}
return differentConfigVersions;
}
use of com.emc.storageos.coordinator.common.Service in project coprhd-controller by CoprHD.
the class CoordinatorClientImpl method isControlNodesDriversSynced.
private boolean isControlNodesDriversSynced(StorageDriversInfo target, Map<Service, StorageDriversInfo> infos) {
Set<String> targetDrivers = new HashSet<String>();
if (target != null) {
targetDrivers = target.getInstalledDrivers();
}
for (Entry<Service, StorageDriversInfo> info : infos.entrySet()) {
String nodeName = info.getKey().getId();
Set<String> installedDrivers = info.getValue().getInstalledDrivers();
if (!targetDrivers.equals(installedDrivers)) {
log.info("Target driver list: {}", Strings.repr(installedDrivers));
log.info("Node {}'s driver list (not synced): {}", nodeName, Strings.repr(installedDrivers));
return false;
}
}
log.info("Driver lists on all nodes in current site are synced with target");
return true;
}
use of com.emc.storageos.coordinator.common.Service in project coprhd-controller by CoprHD.
the class DrUtil method isAllSyssvcUp.
/**
* Check if all syssvc is up and running for specified site
* @param siteId
* @return true if all syssvc is running
*/
public boolean isAllSyssvcUp(String siteId) {
// Get service beacons for given site - - assume syssvc on all sites share same service name in beacon
try {
String syssvcName = ((CoordinatorClientImpl) coordinator).getSysSvcName();
String syssvcVersion = ((CoordinatorClientImpl) coordinator).getSysSvcVersion();
List<Service> svcs = coordinator.locateAllServices(siteId, syssvcName, syssvcVersion, null, null);
Site site = this.getSiteFromLocalVdc(siteId);
log.info("Node count is {}, running syssvc count is", site.getNodeCount(), svcs.size());
return svcs.size() == site.getNodeCount();
} catch (CoordinatorException ex) {
return false;
}
}
use of com.emc.storageos.coordinator.common.Service in project coprhd-controller by CoprHD.
the class CoordinatorClientImpl method getDifferentCurrentsCommon.
/**
* Common method to compare current version with target's current version
*
* @param targetGiven
* target repository
* @param infos
* nodes' repository
* @return list of nodes which current version is different from the target's
*/
private List<String> getDifferentCurrentsCommon(final RepositoryInfo targetGiven, final Map<Service, RepositoryInfo> infos) {
List<String> differentCurrents = new ArrayList<String>();
final SoftwareVersion targetCurrent = targetGiven.getCurrentVersion();
for (Map.Entry<Service, RepositoryInfo> entry : infos.entrySet()) {
if (!targetCurrent.equals(entry.getValue().getCurrentVersion())) {
differentCurrents.add(entry.getKey().getId());
}
}
return differentCurrents;
}
Aggregations