Search in sources :

Example 6 with GeoServiceClient

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;
}
Also used : HashMap(java.util.HashMap) VdcIpsecPropertiesResponse(com.emc.storageos.geomodel.VdcIpsecPropertiesResponse) GeoClientCacheManager(com.emc.storageos.security.geo.GeoClientCacheManager) GeoServiceClient(com.emc.storageos.security.geo.GeoServiceClient)

Example 7 with GeoServiceClient

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;
}
Also used : GeoServiceClient(com.emc.storageos.security.geo.GeoServiceClient)

Example 8 with GeoServiceClient

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();
    }
}
Also used : VdcNodeCheckParam(com.emc.storageos.geomodel.VdcNodeCheckParam) GeoServiceClient(com.emc.storageos.security.geo.GeoServiceClient)

Example 9 with GeoServiceClient

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)));
}
Also used : FileVirtualPoolBulkRep(com.emc.storageos.model.vpool.FileVirtualPoolBulkRep) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) GeoServiceClient(com.emc.storageos.security.geo.GeoServiceClient) VirtualPoolMapper.toFileVirtualPool(com.emc.storageos.api.mapper.VirtualPoolMapper.toFileVirtualPool) MapFileVirtualPool(com.emc.storageos.api.mapper.functions.MapFileVirtualPool) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException)

Example 10 with GeoServiceClient

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)));
}
Also used : VirtualArray(com.emc.storageos.db.client.model.VirtualArray) GeoServiceClient(com.emc.storageos.security.geo.GeoServiceClient) VirtualPoolMapper.toObjectVirtualPool(com.emc.storageos.api.mapper.VirtualPoolMapper.toObjectVirtualPool) MapObjectVirtualPool(com.emc.storageos.api.mapper.functions.MapObjectVirtualPool) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) ObjectVirtualPoolBulkRep(com.emc.storageos.model.vpool.ObjectVirtualPoolBulkRep) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException)

Aggregations

GeoServiceClient (com.emc.storageos.security.geo.GeoServiceClient)17 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)12 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)12 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)8 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)8 MapVirtualArray (com.emc.storageos.api.mapper.functions.MapVirtualArray)4 BulkList (com.emc.storageos.api.service.impl.response.BulkList)4 VirtualPoolMapper.toBlockVirtualPool (com.emc.storageos.api.mapper.VirtualPoolMapper.toBlockVirtualPool)2 VirtualPoolMapper.toFileVirtualPool (com.emc.storageos.api.mapper.VirtualPoolMapper.toFileVirtualPool)2 VirtualPoolMapper.toObjectVirtualPool (com.emc.storageos.api.mapper.VirtualPoolMapper.toObjectVirtualPool)2 MapFileVirtualPool (com.emc.storageos.api.mapper.functions.MapFileVirtualPool)2 MapObjectVirtualPool (com.emc.storageos.api.mapper.functions.MapObjectVirtualPool)2 TenantOrg (com.emc.storageos.db.client.model.TenantOrg)2 VdcNodeCheckParam (com.emc.storageos.geomodel.VdcNodeCheckParam)2 VirtualArrayBulkRep (com.emc.storageos.model.varray.VirtualArrayBulkRep)2 BlockVirtualPoolBulkRep (com.emc.storageos.model.vpool.BlockVirtualPoolBulkRep)2 FileVirtualPoolBulkRep (com.emc.storageos.model.vpool.FileVirtualPoolBulkRep)2 ObjectVirtualPoolBulkRep (com.emc.storageos.model.vpool.ObjectVirtualPoolBulkRep)2 StorageOSUser (com.emc.storageos.security.authentication.StorageOSUser)2 URI (java.net.URI)2