Search in sources :

Example 1 with RecoveryPrecheckStatus

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);
}
Also used : ViPRSystemClient(com.emc.vipr.client.ViPRSystemClient) ClusterInfo(com.emc.vipr.model.sys.ClusterInfo) RecoveryPrecheckStatus(com.emc.vipr.model.sys.recovery.RecoveryPrecheckStatus) RecoveryStatus(com.emc.vipr.model.sys.recovery.RecoveryStatus) DateTime(org.joda.time.DateTime)

Example 2 with RecoveryPrecheckStatus

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;
}
Also used : RecoveryPrecheckStatus(com.emc.vipr.model.sys.recovery.RecoveryPrecheckStatus) DrUtil(com.emc.storageos.coordinator.client.service.DrUtil) ArrayList(java.util.ArrayList) DbOfflineStatus(com.emc.vipr.model.sys.recovery.DbOfflineStatus) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) LocalRepositoryException(com.emc.storageos.systemservices.exceptions.LocalRepositoryException) IOException(java.io.IOException) SysClientException(com.emc.storageos.systemservices.exceptions.SysClientException) ClientHandlerException(com.sun.jersey.api.client.ClientHandlerException) HashSet(java.util.HashSet) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 3 with 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");
    }
}
Also used : MinorityNodeRecoveryJob(jobs.MinorityNodeRecoveryJob) ViPRSystemClient(com.emc.vipr.client.ViPRSystemClient) ClusterInfo(com.emc.vipr.model.sys.ClusterInfo) RecoveryPrecheckStatus(com.emc.vipr.model.sys.recovery.RecoveryPrecheckStatus) RecoveryStatus(com.emc.vipr.model.sys.recovery.RecoveryStatus) NodeHealth(com.emc.vipr.model.sys.healthmonitor.NodeHealth) Restrictions(controllers.deadbolt.Restrictions)

Aggregations

RecoveryPrecheckStatus (com.emc.vipr.model.sys.recovery.RecoveryPrecheckStatus)3 ViPRSystemClient (com.emc.vipr.client.ViPRSystemClient)2 ClusterInfo (com.emc.vipr.model.sys.ClusterInfo)2 RecoveryStatus (com.emc.vipr.model.sys.recovery.RecoveryStatus)2 DrUtil (com.emc.storageos.coordinator.client.service.DrUtil)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)1 LocalRepositoryException (com.emc.storageos.systemservices.exceptions.LocalRepositoryException)1 SysClientException (com.emc.storageos.systemservices.exceptions.SysClientException)1 NodeHealth (com.emc.vipr.model.sys.healthmonitor.NodeHealth)1 DbOfflineStatus (com.emc.vipr.model.sys.recovery.DbOfflineStatus)1 ClientHandlerException (com.sun.jersey.api.client.ClientHandlerException)1 Restrictions (controllers.deadbolt.Restrictions)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 MinorityNodeRecoveryJob (jobs.MinorityNodeRecoveryJob)1