use of com.emc.vipr.model.sys.recovery.DbOfflineStatus in project coprhd-controller by CoprHD.
the class RecoveryManager method initNodeListByCheckOfflineTime.
private void initNodeListByCheckOfflineTime() {
aliveNodes.clear();
corruptedNodes.clear();
ArrayList<String> nodeList = coordinator.getAllNodeIds();
for (String nodeId : nodeList) {
try {
DbOfflineStatus dbOfflineStatus = SysClientFactory.getSysClient(coordinator.getNodeEndpoint(nodeId)).get(SysClientFactory.URI_GET_DB_OFFLINE_STATUS, DbOfflineStatus.class, null);
if (dbOfflineStatus.getOutageTimeExceeded()) {
corruptedNodes.add(nodeId);
} else {
aliveNodes.add(nodeId);
}
} catch (SysClientException e) {
log.warn("Internal error on clean up purge data: ", e.getMessage());
throw e;
}
}
log.info("Alive nodes:{}, corrupted nodes: {}", aliveNodes, corruptedNodes);
}
use of com.emc.vipr.model.sys.recovery.DbOfflineStatus in project coprhd-controller by CoprHD.
the class ControlService method checkDbOfflineTime.
@GET
@Path("internal/node/dbsvc-offline-status")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public DbOfflineStatus checkDbOfflineTime() {
_log.info("Check db offline time");
try {
DbInfoUtils.checkDBOfflineInfo(_coordinator.getCoordinatorClient(), Constants.DBSVC_NAME, "/data/db", false);
DbInfoUtils.checkDBOfflineInfo(_coordinator.getCoordinatorClient(), Constants.GEODBSVC_NAME, "/data/geodb", false);
} catch (IllegalStateException e) {
return new DbOfflineStatus(true);
}
return new DbOfflineStatus(false);
}
use of com.emc.vipr.model.sys.recovery.DbOfflineStatus in project coprhd-controller by CoprHD.
the class ControlService method recoveryPrecheck.
@GET
@Path("cluster/recovery/precheck-status")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SECURITY_ADMIN, Role.RESTRICTED_SECURITY_ADMIN })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public RecoveryPrecheckStatus recoveryPrecheck() {
RecoveryPrecheckStatus recoveryPrecheckStatus = new RecoveryPrecheckStatus();
DrUtil drUtil = new DrUtil(_coordinator.getCoordinatorClient());
if (drUtil.isMultivdc() || drUtil.isMultisite()) {
recoveryPrecheckStatus.setStatus(RecoveryPrecheckStatus.Status.VAPP_IN_DR_OR_GEO);
return recoveryPrecheckStatus;
}
ArrayList<String> nodeList = _coordinator.getAllNodeIds();
HashSet<String> unvaliableNodeSet = new HashSet<>();
ArrayList<String> recoverableNodeList = new ArrayList<>();
for (String nodeId : nodeList) {
Long dbOfflineTime = DbInfoUtils.getDbOfflineTime(_coordinator.getCoordinatorClient(), Constants.DBSVC_NAME, nodeId);
if (dbOfflineTime != null) {
unvaliableNodeSet.add(nodeId);
} else {
dbOfflineTime = DbInfoUtils.getDbOfflineTime(_coordinator.getCoordinatorClient(), Constants.GEODBSVC_NAME, nodeId);
if (dbOfflineTime != null) {
unvaliableNodeSet.add(nodeId);
}
}
try {
DbOfflineStatus dbOfflineStatus = SysClientFactory.getSysClient(_coordinator.getNodeEndpoint(nodeId)).get(SysClientFactory.URI_GET_DB_OFFLINE_STATUS, DbOfflineStatus.class, null);
if (dbOfflineStatus.getOutageTimeExceeded()) {
recoverableNodeList.add(nodeId);
unvaliableNodeSet.add(nodeId);
}
} catch (Exception e) {
recoveryPrecheckStatus.setStatus(RecoveryPrecheckStatus.Status.NODE_UNREACHABLE);
_log.warn("Failed to check dbOfflineStatus on {} :{}", nodeId, e.getMessage());
}
}
ArrayList<String> unvaliableNodeList = new ArrayList<>(unvaliableNodeSet);
setRecoverPrecheckStatus(recoveryPrecheckStatus, unvaliableNodeList, recoverableNodeList, nodeList.size());
recoveryPrecheckStatus.setUnavailables(unvaliableNodeList);
recoveryPrecheckStatus.setRecoverables(recoverableNodeList);
return recoveryPrecheckStatus;
}
Aggregations