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;
}
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());
}
}
Aggregations