Search in sources :

Example 11 with DrUtil

use of com.emc.storageos.coordinator.client.service.DrUtil in project coprhd-controller by CoprHD.

the class StorageDriverManager method setCoordinator.

public void setCoordinator(CoordinatorClientExt coordinator) {
    this.coordinator = coordinator;
    this.coordinatorClient = coordinator.getCoordinatorClient();
    this.drUtil = new DrUtil(coordinatorClient);
}
Also used : DrUtil(com.emc.storageos.coordinator.client.service.DrUtil)

Example 12 with DrUtil

use of com.emc.storageos.coordinator.client.service.DrUtil in project coprhd-controller by CoprHD.

the class CoordinatorClientExt method isActiveSiteHealthy.

/**
 * Check if DR active site is stable and there is ZK leader in active site
 *
 * @return true for stable, otherwise false
 */
public boolean isActiveSiteHealthy() {
    DrUtil drUtil = new DrUtil(_coordinator);
    String activeSiteId = drUtil.getActiveSite().getUuid();
    boolean isActiveSiteLeaderAlive = false;
    boolean isActiveSiteStable = false;
    SiteInfo siteInfo = _coordinator.getTargetInfo(SiteInfo.class);
    if (StringUtils.isEmpty(activeSiteId) && SiteInfo.DR_OP_SWITCHOVER.equals(siteInfo.getActionRequired())) {
        activeSiteId = siteInfo.getTargetSiteUUID();
    }
    if (StringUtils.isEmpty(activeSiteId) || drUtil.getLocalSite().getUuid().equals(activeSiteId)) {
        _log.info("Can't find active site id or local site is active, set active healthy as false");
    } else {
        Site activeSite = drUtil.getSiteFromLocalVdc(activeSiteId);
        isActiveSiteLeaderAlive = isZKLeaderAlive(activeSite);
        isActiveSiteStable = isActiveSiteStable(activeSite);
        _log.info("Active site ZK is alive: {}, active site stable is :{}", isActiveSiteLeaderAlive, isActiveSiteStable);
    }
    return isActiveSiteLeaderAlive && isActiveSiteStable;
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) SiteInfo(com.emc.storageos.coordinator.client.model.SiteInfo) DrUtil(com.emc.storageos.coordinator.client.service.DrUtil)

Example 13 with DrUtil

use of com.emc.storageos.coordinator.client.service.DrUtil in project coprhd-controller by CoprHD.

the class RecoveryManager method validateClusterState.

/**
 * Check if cluster need to do node recovery
 */
private void validateClusterState() {
    ClusterInfo.ClusterState state = null;
    if (!isVMwareVapp()) {
        state = coordinator.getCoordinatorClient().getControlNodesState();
        log.info("Current control nodes' state: {}", state);
        if (state == ClusterInfo.ClusterState.STABLE) {
            log.warn("Cluster is stable and no need to do node recovery");
            throw new IllegalStateException("Cluster is stable and no need to do node recovery");
        }
    } else {
        initNodeListByCheckOfflineTime();
        if (aliveNodes.size() == coordinator.getNodeCount()) {
            log.warn("all nodes in vapp is available and no need to do node recovery");
            throw new IllegalStateException("all nodes in vapp is available and no need to do node recovery");
        }
    }
    // Disable node recovery when standby site state is unexpected as db repair would be failed in these scenarios.
    DrUtil drUtil = new DrUtil(coordinator.getCoordinatorClient());
    if (drUtil.isMultisite()) {
        List<Site> allStandbySites = drUtil.listStandbySites();
        for (Site site : allStandbySites) {
            if (!site.getState().equals(SiteState.STANDBY_SYNCED) && !site.getState().equals(SiteState.STANDBY_PAUSED) && !site.getState().equals(SiteState.STANDBY_DEGRADED)) {
                log.error("Node recovery is not allowed as standby site({}) status is unexpected({})", site.getName(), site.getState());
                throw new IllegalStateException("Node recovery is not allowed as standby site status is unexpected");
            }
        }
    }
    // Disable node recovery when other connected vdc cluster state is DEGRADED as geo db repair would be failed then.
    if (drUtil.isMultivdc()) {
        List<String> allOtherVdcs = drUtil.getOtherVdcIds();
        for (String vdc : allOtherVdcs) {
            state = coordinator.getCoordinatorClient().getControlNodesState(vdc);
            if (state == ClusterInfo.ClusterState.DEGRADED) {
                log.error("Node recovery is not allowed as a connected vdc({}) status is degraded", vdc);
                throw new IllegalStateException("Node recovery is not allowed as a connected vdc status is degraded");
            }
        }
    }
}
Also used : ClusterInfo(com.emc.vipr.model.sys.ClusterInfo) DrUtil(com.emc.storageos.coordinator.client.service.DrUtil)

Example 14 with DrUtil

use of com.emc.storageos.coordinator.client.service.DrUtil in project coprhd-controller by CoprHD.

the class AuditLogManager method setCoordinator.

/**
 * Setter for the data base client.
 *
 * @param dbClient Reference to a database client.
 */
public void setCoordinator(CoordinatorClient coordinator) {
    _coordinator = coordinator;
    drUtil = new DrUtil(_coordinator);
}
Also used : DrUtil(com.emc.storageos.coordinator.client.service.DrUtil)

Example 15 with DrUtil

use of com.emc.storageos.coordinator.client.service.DrUtil in project coprhd-controller by CoprHD.

the class SysSvcImpl method start.

@Override
public void start() throws Exception {
    if (_app != null) {
        initThreadUncaughtExceptionHandler();
        initServer();
        initSysClientFactory();
        _server.start();
        // only data node needs to poll the cluster's address change
        if (!_coordinator.isControlNode()) {
            _clusterPoller.start();
        }
        startNewVersionCheck();
        startUpgradeManager();
        startSecretsManager();
        startIpReconfigManager();
        // config cassandra as client mode to avoid load yaml file
        Config.setClientMode(true);
        DrUtil drUtil = _coordinator.getDrUtil();
        if (drUtil.isActiveSite()) {
            _recoveryMgr.init();
            startSystemAudit(_dbClient);
        }
        _svcBeacon.start();
        // start property manager and vdc manager after beacon is registered
        // since they would update beacon
        startPropertyManager();
        startVdcManager();
        startDiagnosticsScheduler();
        drPostFailoverDBCheckHandler.run();
        _driverMgr.start();
    } else {
        throw new Exception("No app found.");
    }
}
Also used : DrUtil(com.emc.storageos.coordinator.client.service.DrUtil)

Aggregations

DrUtil (com.emc.storageos.coordinator.client.service.DrUtil)26 Site (com.emc.storageos.coordinator.client.model.Site)11 DbClientContext (com.emc.storageos.db.client.impl.DbClientContext)4 SiteInfo (com.emc.storageos.coordinator.client.model.SiteInfo)3 CoordinatorClientInetAddressMap (com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap)3 ConfigurationImpl (com.emc.storageos.coordinator.common.impl.ConfigurationImpl)3 PropertyInfoMapper.decodeFromString (com.emc.storageos.coordinator.mapper.PropertyInfoMapper.decodeFromString)3 SiteState (com.emc.storageos.coordinator.client.model.SiteState)2 CoordinatorClient (com.emc.storageos.coordinator.client.service.CoordinatorClient)2 Configuration (com.emc.storageos.coordinator.common.Configuration)2 Service (com.emc.storageos.coordinator.common.Service)2 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)2 SysClientException (com.emc.storageos.systemservices.exceptions.SysClientException)2 ClusterInfo (com.emc.vipr.model.sys.ClusterInfo)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 Before (org.junit.Before)2 SiteMapper (com.emc.storageos.api.mapper.SiteMapper)1 DbVersionInfo (com.emc.storageos.coordinator.client.model.DbVersionInfo)1 MigrationStatus (com.emc.storageos.coordinator.client.model.MigrationStatus)1