use of com.emc.storageos.security.geo.GeoServiceClient in project coprhd-controller by CoprHD.
the class IPSecMonitor method getIpsecPropsThroughHTTPS.
private Map<String, String> getIpsecPropsThroughHTTPS(String node) {
Map<String, String> props = new HashMap<String, String>();
try {
GeoClientCacheManager geoClientMgr = getGeoClientManager();
if (geoClientMgr != null) {
GeoServiceClient geoClient = geoClientMgr.getGeoClient(getVdcShortIdByIp(node));
String version = geoClient.getViPRVersion();
if (version.compareTo("vipr-2.5") < 0) {
log.info("remote vdc version is less than 2.5, skip getting ipsec properties");
return props;
}
VdcIpsecPropertiesResponse ipsecProperties = geoClient.getIpsecProperties();
if (ipsecProperties != null) {
props.put(IPSEC_KEY, ipsecProperties.getIpsecKey());
props.put(VDC_CONFIG_VERSION, ipsecProperties.getVdcConfigVersion());
props.put(IPSEC_STATUS, ipsecProperties.getIpsecStatus());
}
} else {
log.warn("GeoClientCacheManager is null, skip getting ipsec properties from " + node);
}
} catch (Exception e) {
log.warn("can't get ipsec properties from remote vdc: " + node, e);
}
return props;
}
use of com.emc.storageos.security.geo.GeoServiceClient in project coprhd-controller by CoprHD.
the class VdcConfigHelper method resetGeoClientCacheTimeout.
/*
* Use this method to reset GeoServiceClient timeout value
* For add vdc, it should be 1 min
* For disconnect node reachable check, should be 3 mins
* For reconnect node reachable check, should be 1 min
*/
public GeoServiceClient resetGeoClientCacheTimeout(String vdcShortId, Properties vdcInfo, int nodeCheckTimeout_ms) {
// clear the client cache to ensure that we create a new connection with a longer timeout
// timeout for makeing the geosvc socket connection is 30 seconds, so this timeout needs to be longer than that
geoClientCache.clearCache();
GeoServiceClient client;
if (vdcInfo == null) {
client = geoClientCache.getGeoClient(vdcShortId);
} else {
client = geoClientCache.getGeoClient(vdcInfo);
}
client.setClientConnectTimeout(nodeCheckTimeout_ms);
client.setClientReadTimeout(nodeCheckTimeout_ms);
return client;
}
use of com.emc.storageos.security.geo.GeoServiceClient in project coprhd-controller by CoprHD.
the class ConnectVdcTaskOp method sendVdcNodeCheckRequest.
/**
* @param remoteVdcInfo
* @param virtualDataCenters
* @return
*/
private VdcNodeCheckResponse sendVdcNodeCheckRequest(Properties remoteVdcInfo, List<VdcConfig> virtualDataCenters) {
log.info("sending {} vdcs to {} to be checked", virtualDataCenters.size(), remoteVdcInfo.getProperty(GeoServiceJob.VDC_SHORT_ID));
VdcNodeCheckParam param = new VdcNodeCheckParam();
param.setVirtualDataCenters(virtualDataCenters);
try {
GeoServiceClient client = helper.resetGeoClientCacheTimeout(null, remoteVdcInfo, NODE_CHECK_TIMEOUT);
return client.vdcNodeCheck(param);
} finally {
// clear the client cache to reset timeouts that were altered above
geoClientCache.clearCache();
}
}
use of com.emc.storageos.security.geo.GeoServiceClient in project coprhd-controller by CoprHD.
the class FileVirtualPoolService method queryBulkResourceReps.
@Override
public FileVirtualPoolBulkRep queryBulkResourceReps(List<URI> ids) {
if (!ids.iterator().hasNext()) {
return new FileVirtualPoolBulkRep();
}
// get vdc id from the first id; assume all id's are from the same vdc
String shortVdcId = VdcUtil.getVdcId(VirtualArray.class, ids.iterator().next()).toString();
Iterator<VirtualPool> dbIterator;
if (shortVdcId.equals(VdcUtil.getLocalShortVdcId())) {
dbIterator = _dbClient.queryIterativeObjects(getResourceClass(), ids);
} else {
GeoServiceClient geoClient = _geoHelper.getClient(shortVdcId);
try {
dbIterator = geoClient.queryObjects(getResourceClass(), ids);
} catch (Exception ex) {
// TODO: revisit this exception
_log.error("error retrieving bulk virtual pools from vdc " + shortVdcId, ex);
throw APIException.internalServerErrors.genericApisvcError("error retrieving remote virtual pool", ex);
}
}
return new FileVirtualPoolBulkRep(BulkList.wrapping(dbIterator, new mapFileVirtualPoolWithResources(), new BulkList.VirtualPoolFilter(Type.file)));
}
use of com.emc.storageos.security.geo.GeoServiceClient in project coprhd-controller by CoprHD.
the class ObjectVirtualPoolService method queryBulkResourceReps.
/**
* Gets list of all Object Virtual pool IDs
*/
@Override
public ObjectVirtualPoolBulkRep queryBulkResourceReps(List<URI> ids) {
if (!ids.iterator().hasNext()) {
return new ObjectVirtualPoolBulkRep();
}
// get vdc id from the first id; assume all id's are from the same vdc
String shortVdcId = VdcUtil.getVdcId(VirtualArray.class, ids.iterator().next()).toString();
Iterator<VirtualPool> dbIterator;
if (shortVdcId.equals(VdcUtil.getLocalShortVdcId())) {
dbIterator = _dbClient.queryIterativeObjects(getResourceClass(), ids);
} else {
GeoServiceClient geoClient = _geoHelper.getClient(shortVdcId);
try {
dbIterator = geoClient.queryObjects(getResourceClass(), ids);
} catch (Exception ex) {
// TODO: revisit this exception
_log.error("error retrieving bulk virtual pools from vdc " + shortVdcId, ex);
throw APIException.internalServerErrors.genericApisvcError("error retrieving remote virtual pool", ex);
}
}
return new ObjectVirtualPoolBulkRep(BulkList.wrapping(dbIterator, new mapObjectVirtualPoolWithResources(), new BulkList.VirtualPoolFilter(Type.object)));
}
Aggregations