Search in sources :

Example 1 with SiteError

use of com.emc.storageos.coordinator.client.model.SiteError 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
    }
}
Also used : SiteErrorResponse(com.emc.storageos.model.dr.SiteErrorResponse) SiteError(com.emc.storageos.coordinator.client.model.SiteError) Date(java.util.Date) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) BadRequestException(com.emc.storageos.svcs.errorhandling.resources.BadRequestException) InternalServerErrorException(com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) Test(org.junit.Test)

Example 2 with SiteError

use of com.emc.storageos.coordinator.client.model.SiteError in project coprhd-controller by CoprHD.

the class VdcOpHandler method populateStandbySiteErrorIfNecessary.

protected void populateStandbySiteErrorIfNecessary(Site site, InternalServerErrorException e) {
    SiteState operation = site.getState();
    SiteError error = new SiteError(e, operation.name());
    log.info("set site {} state to STANDBY_ERROR, set lastState to {}", site.getName(), site.getState());
    coordinator.getCoordinatorClient().setTargetInfo(site.getUuid(), error);
    site.setLastState(site.getState());
    site.setState(SiteState.STANDBY_ERROR);
    coordinator.getCoordinatorClient().persistServiceConfiguration(site.toConfiguration());
}
Also used : SiteState(com.emc.storageos.coordinator.client.model.SiteState) SiteError(com.emc.storageos.coordinator.client.model.SiteError)

Aggregations

SiteError (com.emc.storageos.coordinator.client.model.SiteError)2 SiteState (com.emc.storageos.coordinator.client.model.SiteState)1 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)1 SiteErrorResponse (com.emc.storageos.model.dr.SiteErrorResponse)1 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)1 BadRequestException (com.emc.storageos.svcs.errorhandling.resources.BadRequestException)1 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 Date (java.util.Date)1 Test (org.junit.Test)1