use of com.emc.storageos.model.dr.SiteErrorResponse in project coprhd-controller by CoprHD.
the class InternalSiteServiceClient method resumePrecheck.
public void resumePrecheck() {
WebResource rRoot = createRequest(SITE_INTERNAL_RESUMEPRECHECK);
SiteErrorResponse response;
try {
response = addSignature(rRoot).post(SiteErrorResponse.class);
} catch (Exception e) {
throw APIException.internalServerErrors.resumeStandbyPrecheckFailed(site.getName(), e.getMessage());
}
if (response != null && response.isErrorResponse()) {
throw APIException.internalServerErrors.resumeStandbyPrecheckFailed(site.getName(), response.getErrorMessage());
}
}
use of com.emc.storageos.model.dr.SiteErrorResponse in project coprhd-controller by CoprHD.
the class InternalSiteServiceClient method switchoverPrecheck.
public void switchoverPrecheck() {
WebResource rRoot = createRequest(SITE_INTERNAL_SWITCHOVERPRECHECK);
SiteErrorResponse response;
try {
response = addSignature(rRoot).post(SiteErrorResponse.class);
} catch (Exception e) {
throw APIException.internalServerErrors.switchoverPrecheckFailed(site.getName(), e.getMessage());
}
if (response != null && response.isErrorResponse()) {
throw APIException.internalServerErrors.switchoverPrecheckFailed(site.getName(), response.getErrorMessage());
}
}
use of com.emc.storageos.model.dr.SiteErrorResponse in project coprhd-controller by CoprHD.
the class DisasterRecoveryServiceTest method testGetSiteError.
@Test
public void testGetSiteError() {
SiteErrorResponse siteError = drService.getSiteError("site-uuid-1");
assertEquals(null, siteError.getCreationTime());
assertEquals(null, siteError.getErrorMessage());
assertEquals(null, siteError.getOperation());
standbySite2.setState(SiteState.STANDBY_ERROR);
standbySite2.setLastState(SiteState.STANDBY_ADDING);
SiteError error = new SiteError(APIException.internalServerErrors.addStandbyFailedTimeout(20), SiteState.STANDBY_PAUSING.name());
doReturn(error).when(coordinator).getTargetInfo(standbySite2.getUuid(), SiteError.class);
siteError = drService.getSiteError(standbySite2.getUuid());
assertEquals(new Date(error.getCreationTime()), siteError.getCreationTime());
assertEquals(error.getErrorMessage(), siteError.getErrorMessage());
assertEquals(error.getOperation(), siteError.getOperation());
try {
drService.getSiteError(NONEXISTENT_ID);
assert false;
} catch (Exception e) {
// ingore expected exception
}
}
use of com.emc.storageos.model.dr.SiteErrorResponse in project coprhd-controller by CoprHD.
the class DisasterRecoveryService method switchoverPrecheck.
/**
* This is internal API to do precheck for switchover
*
* @return return response with error message and service code
*/
@POST
@Path("/internal/switchoverprecheck")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public SiteErrorResponse switchoverPrecheck() {
log.info("Precheck for switchover internally");
SiteErrorResponse response = new SiteErrorResponse();
try {
precheckForSwitchoverForLocalStandby();
} catch (InternalServerErrorException e) {
log.warn("Failed to precheck switchover", e);
response.setErrorMessage(e.getMessage());
response.setServiceCode(e.getServiceCode().ordinal());
return response;
} catch (Exception e) {
log.error("Failed to precheck switchover", e);
response.setErrorMessage(e.getMessage());
return response;
}
return response;
}
use of com.emc.storageos.model.dr.SiteErrorResponse in project coprhd-controller by CoprHD.
the class DisasterRecovery method errorDetails.
public static void errorDetails(String id) {
Boolean isError = false;
String uuid = id;
// site id doesn't exist
if (!DisasterRecoveryUtils.hasStandbySite(id)) {
SiteDetailRestRep disasterSiteTime = new SiteDetailRestRep();
uuid = "Unknown Standby site id: " + id;
render(isError, uuid, disasterSiteTime);
}
SiteRestRep siteRest = DisasterRecoveryUtils.getSite(id);
// site is in STANDBY_ERROR state
if (siteRest.getState().equals(String.valueOf(SiteState.STANDBY_ERROR))) {
SiteErrorResponse disasterSiteError = DisasterRecoveryUtils.getSiteError(id);
isError = true;
if (disasterSiteError.getCreationTime() != null) {
DateTime errorCreationTime = new DateTime(disasterSiteError.getCreationTime().getTime());
renderArgs.put("errorCreationTime", errorCreationTime);
}
DateTime siteCreationTime = new DateTime(siteRest.getCreateTime());
renderArgs.put("siteCreationTime", siteCreationTime);
if (disasterSiteError.getOperation() != null) {
String operation = disasterSiteError.getOperation();
renderArgs.put("operation", operation);
}
render(isError, uuid, disasterSiteError);
}
SiteDetailRestRep disasterSiteDetails = DisasterRecoveryUtils.getSiteDetails(id);
Boolean isActive = isActiveSiteState(Enum.valueOf(SiteState.class, siteRest.getState()));
renderArgs.put("isActive", isActive);
if (disasterSiteDetails.getLastSyncTime() != null) {
DateTime lastSyncTime = new DateTime(disasterSiteDetails.getLastSyncTime().getTime());
renderArgs.put("lastSyncTime", lastSyncTime);
}
if (disasterSiteDetails.getCreationTime() != null) {
DateTime creationTime = new DateTime(disasterSiteDetails.getCreationTime().getTime());
renderArgs.put("creationTime", creationTime);
}
render(isError, uuid, disasterSiteDetails);
}
Aggregations