Search in sources :

Example 1 with FailoverPrecheckResponse

use of com.emc.storageos.model.dr.FailoverPrecheckResponse in project coprhd-controller by CoprHD.

the class DisasterRecoveryService method failoverPrecheck.

/**
 * This is internal API to do precheck for failover
 *
 * @return return response with error message and service code
 */
@POST
@Path("/internal/failoverprecheck")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public FailoverPrecheckResponse failoverPrecheck() {
    log.info("Precheck for failover internally");
    FailoverPrecheckResponse response = new FailoverPrecheckResponse();
    response.setSite(this.siteMapper.map(drUtil.getLocalSite()));
    try {
        precheckForFailover();
    } catch (InternalServerErrorException e) {
        log.warn("Failed to precheck failover", e);
        response.setErrorMessage(e.getMessage());
        response.setServiceCode(e.getServiceCode().ordinal());
        return response;
    } catch (Exception e) {
        log.error("Failed to precheck failover", e);
        response.setErrorMessage(e.getMessage());
        return response;
    }
    return response;
}
Also used : FailoverPrecheckResponse(com.emc.storageos.model.dr.FailoverPrecheckResponse) InternalServerErrorException(com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) InternalServerErrorException(com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) RetryableCoordinatorException(com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException) UnknownHostException(java.net.UnknownHostException) Path(javax.ws.rs.Path) ZkPath(com.emc.storageos.coordinator.common.impl.ZkPath) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 2 with FailoverPrecheckResponse

use of com.emc.storageos.model.dr.FailoverPrecheckResponse in project coprhd-controller by CoprHD.

the class InternalSiteServiceClient method failoverPrecheck.

public void failoverPrecheck() {
    WebResource rRoot = createRequest(SITE_INTERNAL_FAILOVERPRECHECK);
    ClientResponse resp = null;
    try {
        resp = addSignature(rRoot).post(ClientResponse.class);
    } catch (Exception e) {
        log.error("Fail to send request to precheck failover", e);
        // throw APIException.internalServerErrors.failoverPrecheckFailed(site.getName(), String.format("Can't connect to standby to do precheck for failover, %s", e.getMessage()));
        return;
    }
    FailoverPrecheckResponse response = resp.getEntity(FailoverPrecheckResponse.class);
    if (response != null && response.isErrorResponse()) {
        throw APIException.internalServerErrors.failoverPrecheckFailed(site.getName(), response.getErrorMessage());
    }
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) FailoverPrecheckResponse(com.emc.storageos.model.dr.FailoverPrecheckResponse) WebResource(com.sun.jersey.api.client.WebResource) UniformInterfaceException(com.sun.jersey.api.client.UniformInterfaceException) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException)

Aggregations

FailoverPrecheckResponse (com.emc.storageos.model.dr.FailoverPrecheckResponse)2 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)2 ZkPath (com.emc.storageos.coordinator.common.impl.ZkPath)1 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)1 RetryableCoordinatorException (com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException)1 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)1 ClientResponse (com.sun.jersey.api.client.ClientResponse)1 UniformInterfaceException (com.sun.jersey.api.client.UniformInterfaceException)1 WebResource (com.sun.jersey.api.client.WebResource)1 UnknownHostException (java.net.UnknownHostException)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1