Search in sources :

Example 1 with SiteMonitorResult

use of com.emc.storageos.coordinator.client.model.SiteMonitorResult in project coprhd-controller by CoprHD.

the class SiteMapper method mapWithNetwork.

public SiteRestRep mapWithNetwork(Site from, DrUtil drUtil) {
    if (from == null) {
        return null;
    }
    SiteRestRep to = new SiteRestRep();
    map(from, to);
    NetworkHealth networkHealth = drUtil.getSiteNetworkState(from.getUuid()).getNetworkHealth();
    SiteState state = from.getState();
    // Skip network health state amid ADDING/RESUMING
    if (networkHealth != null && SiteState.STANDBY_ADDING != state && SiteState.STANDBY_RESUMING != state) {
        to.setNetworkHealth(networkHealth.toString());
    }
    // check if syssvc are up
    boolean runningState = drUtil.isSiteUp(from.getUuid());
    if (runningState && !from.getState().equals(SiteState.ACTIVE)) {
        // check if dbsvc are up
        SiteMonitorResult monitorResult = drUtil.getCoordinator().getTargetInfo(from.getUuid(), SiteMonitorResult.class);
        if (monitorResult != null && monitorResult.getDbQuorumLostSince() > 0) {
            runningState = false;
        }
    }
    to.setRunningState(runningState);
    return to;
}
Also used : SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) SiteState(com.emc.storageos.coordinator.client.model.SiteState) SiteMonitorResult(com.emc.storageos.coordinator.client.model.SiteMonitorResult) NetworkHealth(com.emc.storageos.coordinator.client.model.SiteNetworkState.NetworkHealth)

Example 2 with SiteMonitorResult

use of com.emc.storageos.coordinator.client.model.SiteMonitorResult in project coprhd-controller by CoprHD.

the class DbRebuildRunnable method run.

@Override
public void run() {
    if (isRunning) {
        log.info("db rebuild in progress, nothing to do");
        return;
    }
    DrUtil drUtil = new DrUtil(coordinator);
    Site localSite = drUtil.getLocalSite();
    if (!localSite.getState().equals(SiteState.STANDBY_SYNCING)) {
        log.info("db in sync, nothing to do");
        return;
    }
    Configuration dbconfig = coordinator.queryConfiguration(coordinator.getSiteId(), coordinator.getVersionedDbConfigPath(service.getName(), service.getVersion()), service.getId());
    if (isLastDataSyncCurrent(dbconfig)) {
        log.info("last data sync time is later than the target site info update, nothing to do");
        return;
    }
    Site primarySite = drUtil.getActiveSite();
    String sourceDc = drUtil.getCassandraDcId(primarySite);
    log.info("starting db rebuild from source dc {}", sourceDc);
    isRunning = true;
    StorageService.instance.rebuild(sourceDc);
    long currentSyncTime = System.currentTimeMillis();
    log.info("local db rebuild finishes. Updating last data sync time to {}", currentSyncTime);
    dbconfig.setConfig(DbConfigConstants.LAST_DATA_SYNC_TIME, String.valueOf(currentSyncTime));
    coordinator.persistServiceConfiguration(coordinator.getSiteId(), dbconfig);
    if (dbRebuildComplete(Constants.DBSVC_NAME) && dbRebuildComplete(Constants.GEODBSVC_NAME)) {
        localSite = drUtil.getLocalSite();
        // do nothing if it gets set to STANDBY_ERROR earlier
        if (localSite.getState().equals(SiteState.STANDBY_SYNCING)) {
            purgeOldDataRevision(drUtil);
            // reset heartbeat for this site
            SiteMonitorResult dbHeartbeat = coordinator.getTargetInfo(localSite.getUuid(), SiteMonitorResult.class);
            if (dbHeartbeat != null) {
                dbHeartbeat.setDbQuorumLostSince(0);
                coordinator.setTargetInfo(localSite.getUuid(), dbHeartbeat);
                log.info("Reset db heartbeat state for {}", localSite.getUuid());
            }
            log.info("all db rebuild finish, updating site state to STANDBY_SYNCED");
            localSite.setState(SiteState.STANDBY_SYNCED);
            coordinator.persistServiceConfiguration(localSite.toConfiguration());
        }
    }
    isRunning = false;
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) Configuration(com.emc.storageos.coordinator.common.Configuration) SiteMonitorResult(com.emc.storageos.coordinator.client.model.SiteMonitorResult) DrUtil(com.emc.storageos.coordinator.client.service.DrUtil)

Example 3 with SiteMonitorResult

use of com.emc.storageos.coordinator.client.model.SiteMonitorResult in project coprhd-controller by CoprHD.

the class DbManager method checkAndSetIncrementalSyncing.

private void checkAndSetIncrementalSyncing(InetAddress endpoint) {
    Site site = getSite(endpoint);
    if (site == null) {
        log.info("Unknown site for {}. Skip HandoffLogDetector", endpoint);
        return;
    }
    log.info("Node {} in site {} comes online", endpoint, site.getUuid());
    if (site.getState() == SiteState.STANDBY_SYNCED) {
        SiteMonitorResult monitorResult = drUtil.getCoordinator().getTargetInfo(site.getUuid(), SiteMonitorResult.class);
        if (monitorResult == null || monitorResult.getDbQuorumLostSince() == 0) {
            log.info("No db quorum lost on standby site. Skip this node up event on {} ", endpoint);
            return;
        }
        if (hasPendingHintedHandoff(endpoint)) {
            log.info("Hinted handoff logs detected. Change site {} state to STANDBY_INCR_SYNCING", site.getUuid());
            site.setState(SiteState.STANDBY_INCR_SYNCING);
            drUtil.getCoordinator().persistServiceConfiguration(site.toConfiguration());
        }
    } else {
        log.info("Skip hinted handoff logs detector for {} due to site state is {}. ", endpoint, site.getState());
    }
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) SiteMonitorResult(com.emc.storageos.coordinator.client.model.SiteMonitorResult)

Aggregations

SiteMonitorResult (com.emc.storageos.coordinator.client.model.SiteMonitorResult)3 Site (com.emc.storageos.coordinator.client.model.Site)2 NetworkHealth (com.emc.storageos.coordinator.client.model.SiteNetworkState.NetworkHealth)1 SiteState (com.emc.storageos.coordinator.client.model.SiteState)1 DrUtil (com.emc.storageos.coordinator.client.service.DrUtil)1 Configuration (com.emc.storageos.coordinator.common.Configuration)1 SiteRestRep (com.emc.storageos.model.dr.SiteRestRep)1