use of com.emc.vipr.model.sys.recovery.RecoveryPrecheckStatus in project coprhd-controller by CoprHD.
the class SystemHealth method nodeRecoveryVapp.
public static void nodeRecoveryVapp() {
ViPRSystemClient client = BourneUtil.getSysClient();
RecoveryStatus recoveryStatus = client.control().getRecoveryStatus();
if (recoveryStatus.getStartTime() != null) {
DateTime startTime = new DateTime(recoveryStatus.getStartTime().getTime());
renderArgs.put("startTime", startTime);
}
if (recoveryStatus.getEndTime() != null) {
DateTime endTime = new DateTime(recoveryStatus.getEndTime().getTime());
renderArgs.put("endTime", endTime);
}
RecoveryPrecheckStatus recoveryPrecheckStatus = client.control().getRecoveryPrecheckStatus();
String precheckMsg = "";
switch(recoveryPrecheckStatus.getStatus()) {
case RECOVERY_NEEDED:
precheckMsg = Messages.get("nodeRecovery.precheck.success", recoveryPrecheckStatus.getRecoverables().toString());
break;
case ALL_GOOD:
precheckMsg = Messages.get("nodeRecovery.precheck.fail.allgood");
break;
case VAPP_IN_DR_OR_GEO:
precheckMsg = Messages.get("nodeRecovery.precheck.fail.drorgeo");
break;
case NODE_UNREACHABLE:
precheckMsg = Messages.get("nodeRecovery.precheck.fail.unreachable");
break;
case CORRUPTED_NODE_COUNT_MORE_THAN_QUORUM:
precheckMsg = Messages.get("nodeRecovery.precheck.fail.quorum");
break;
case CORRUPTED_NODE_FOR_OTHER_REASON:
precheckMsg = Messages.get("nodeRecovery.precheck.fail.other");
break;
}
renderArgs.put("precheckMsg", precheckMsg);
renderArgs.put("precheckStatus", recoveryPrecheckStatus.getStatus().name());
String recoveringMsg = Messages.get("nodeRecovery.recovering.status", recoveryPrecheckStatus.getRecoverables().toString());
renderArgs.put("recoveringMsg", recoveringMsg);
ClusterInfo clusterInfo = AdminDashboardUtils.getClusterInfo();
render(recoveryStatus, clusterInfo);
}
use of com.emc.vipr.model.sys.recovery.RecoveryPrecheckStatus 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;
}
use of com.emc.vipr.model.sys.recovery.RecoveryPrecheckStatus in project coprhd-controller by CoprHD.
the class SystemHealth method minorityNodeRecovery.
@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void minorityNodeRecovery() {
new MinorityNodeRecoveryJob(getSysClient()).in(3);
ViPRSystemClient client = BourneUtil.getSysClient();
List<NodeHealth> nodeHealthList = MonitorUtils.getNodeHealth();
ClusterInfo clusterInfo = AdminDashboardUtils.getClusterInfo();
if (PlatformUtils.isVMwareVapp()) {
RecoveryPrecheckStatus recoveryPrecheckStatus = client.control().getRecoveryPrecheckStatus();
String recoveringMsg = Messages.get("nodeRecovery.recovering.status", recoveryPrecheckStatus.getRecoverables().toString());
renderArgs.put("recoveringMsg", recoveringMsg);
}
RecoveryStatus recoveryStatus = client.control().getRecoveryStatus();
renderArgs.put("nodeHealthList", nodeHealthList);
renderArgs.put("clusterInfo", clusterInfo);
renderArgs.put("recoveryStatus", recoveryStatus);
if (PlatformUtils.isVMwareVapp()) {
render("@nodeRecoveryVapp");
} else {
render("@nodeRecovery");
}
}
Aggregations