use of com.emc.vipr.model.sys.recovery.RecoveryStatus 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.RecoveryStatus in project coprhd-controller by CoprHD.
the class SystemHealth method getRecoveryStatus.
@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void getRecoveryStatus() {
ViPRSystemClient client = BourneUtil.getSysClient();
RecoveryStatus recoveryStatus = client.control().getRecoveryStatus();
JsonElement jsonElement = new Gson().toJsonTree(recoveryStatus);
JsonObject jsonObj = jsonElement.getAsJsonObject();
if (recoveryStatus.getStartTime() != null) {
DateTime startTime = new DateTime(recoveryStatus.getStartTime().getTime());
jsonObj.addProperty("startTime", startTime.toString());
}
if (recoveryStatus.getEndTime() != null) {
DateTime endTime = new DateTime(recoveryStatus.getEndTime().getTime());
jsonObj.addProperty("endTime", endTime.toString());
}
renderJSON(jsonObj.toString());
}
use of com.emc.vipr.model.sys.recovery.RecoveryStatus in project coprhd-controller by CoprHD.
the class SystemHealth method nodeRecovery.
public static void nodeRecovery() {
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);
}
ClusterInfo clusterInfo = AdminDashboardUtils.getClusterInfo();
render(recoveryStatus, clusterInfo);
}
use of com.emc.vipr.model.sys.recovery.RecoveryStatus in project coprhd-controller by CoprHD.
the class RecoveryManager method checkRecoveryStatus.
/**
* Check the recovery status saved in ZK.
* a. No recovery required(DONE/FAILED/NULL): nothing to do. simply wait
* b. In progress(PREPARING/REPAIRING/SYNCING): fail new request if there is one in progress
* c. Triggering(INIT): current node should take charge of node recovery
*/
private void checkRecoveryStatus() throws Exception {
while (true) {
InterProcessLock lock = null;
try {
lock = getRecoveryLock();
RecoveryStatus status = queryNodeRecoveryStatus();
if (isRecovering(status)) {
log.warn("This is a stale recovery request due to recovery leader change");
return;
} else if (isTriggering(status)) {
log.info("The recovery status is triggering so run recovery directly");
return;
}
setWaitingRecoveryTriggeringFlag(true);
} catch (Exception e) {
markRecoveryFailed(RecoveryStatus.ErrorCode.INTERNAL_ERROR);
throw e;
} finally {
releaseLock(lock);
}
log.info("Wait to be triggered");
waitOnRecoveryTriggering();
}
}
use of com.emc.vipr.model.sys.recovery.RecoveryStatus in project coprhd-controller by CoprHD.
the class RecoveryManager method setRecoveryStatusWithEndTimeMarked.
/**
* Update node recovery status to ZK
*/
private void setRecoveryStatusWithEndTimeMarked(RecoveryStatus.Status status) {
if (!isLeader.get()) {
log.warn("This node is not the recovery leader");
throw new IllegalStateException("This node is not the recovery leader");
}
RecoveryStatus recoveryStatus = queryNodeRecoveryStatus();
recoveryStatus.setStatus(status);
recoveryStatus.setEndTime(new Date());
persistNodeRecoveryStatus(recoveryStatus);
}
Aggregations