Search in sources :

Example 1 with SysClient

use of com.emc.storageos.systemservices.impl.client.SysClientFactory.SysClient in project coprhd-controller by CoprHD.

the class CoordinatorClientExt method isActiveSiteStable.

public boolean isActiveSiteStable(Site activeSite) {
    // check if cluster state is stable
    String vip = activeSite.getVipEndPoint();
    int port = _svc.getEndpoint().getPort();
    String baseNodeURL = String.format(SysClientFactory.BASE_URL_FORMAT, vip, port);
    try {
        SysClient client = SysClientFactory.getSysClient(URI.create(baseNodeURL), CHECK_ACTIVE_SITE_STABLE_READ_TIMEOUT_MS, CHECK_ACTIVE_SITE_STABLE_CONNECT_TIMEOUT_MS);
        ClusterInfo clusterInfo = client.get(URI.create(URI_INTERNAL_GET_CLUSTER_INFO), ClusterInfo.class, null);
        _log.info("Get cluster info from active site {}", clusterInfo.getCurrentState());
        if (ClusterState.STABLE.equals(ClusterState.valueOf(clusterInfo.getCurrentState()))) {
            return true;
        }
    } catch (Exception ex) {
        _log.warn("Encounter error when call Sys API on active site{} ", ex.toString());
    }
    return false;
}
Also used : ClusterInfoMapper.toClusterInfo(com.emc.storageos.systemservices.mapper.ClusterInfoMapper.toClusterInfo) ClusterInfo(com.emc.vipr.model.sys.ClusterInfo) SysClient(com.emc.storageos.systemservices.impl.client.SysClientFactory.SysClient) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) SyssvcException(com.emc.storageos.systemservices.exceptions.SyssvcException) InvalidLockOwnerException(com.emc.storageos.systemservices.exceptions.InvalidLockOwnerException) IOException(java.io.IOException) CoordinatorClientException(com.emc.storageos.systemservices.exceptions.CoordinatorClientException)

Aggregations

CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)1 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)1 CoordinatorClientException (com.emc.storageos.systemservices.exceptions.CoordinatorClientException)1 InvalidLockOwnerException (com.emc.storageos.systemservices.exceptions.InvalidLockOwnerException)1 SyssvcException (com.emc.storageos.systemservices.exceptions.SyssvcException)1 SysClient (com.emc.storageos.systemservices.impl.client.SysClientFactory.SysClient)1 ClusterInfoMapper.toClusterInfo (com.emc.storageos.systemservices.mapper.ClusterInfoMapper.toClusterInfo)1 ClusterInfo (com.emc.vipr.model.sys.ClusterInfo)1 IOException (java.io.IOException)1