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);
}
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;
}
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");
}
}
}
}
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);
}
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.");
}
}
Aggregations