use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.
the class DisasterRecoveryServiceTest method testResumeStandby.
@Test
public void testResumeStandby() {
try {
drService.resumeStandby(primarySite.getUuid());
} catch (APIException e) {
assertEquals(e.getServiceCode(), ServiceCode.API_BAD_REQUEST);
}
try {
drService.resumeStandby(NONEXISTENT_ID);
} catch (APIException e) {
assertEquals(e.getServiceCode(), ServiceCode.API_PARAMETER_INVALID);
}
doNothing().when(coordinator).persistServiceConfiguration(any(Configuration.class));
doReturn(null).when(coordinator).getTargetInfo(any(String.class), eq(SiteInfo.class));
doNothing().when(coordinator).setTargetInfo(any(String.class), any(SiteInfo.class));
InternalSiteServiceClient internalSiteClient = mock(InternalSiteServiceClient.class);
doReturn(internalSiteClient).when(drService).createInternalSiteServiceClient(any(Site.class));
try {
SiteRestRep response = drService.resumeStandby(standbySite1.getUuid());
assertEquals(SiteState.STANDBY_PAUSED.toString(), response.getState());
} catch (Exception e) {
fail();
}
}
use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.
the class SiteMapper method map.
public SiteRestRep map(Site from) {
if (from == null) {
return null;
}
SiteRestRep to = new SiteRestRep();
map(from, to);
return to;
}
use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.
the class SiteMapper method mapWithNetwork.
public SiteRestRep mapWithNetwork(Site from, DrUtil drUtil) {
if (from == null) {
return null;
}
SiteRestRep to = new SiteRestRep();
map(from, to);
NetworkHealth networkHealth = drUtil.getSiteNetworkState(from.getUuid()).getNetworkHealth();
SiteState state = from.getState();
// Skip network health state amid ADDING/RESUMING
if (networkHealth != null && SiteState.STANDBY_ADDING != state && SiteState.STANDBY_RESUMING != state) {
to.setNetworkHealth(networkHealth.toString());
}
// check if syssvc are up
boolean runningState = drUtil.isSiteUp(from.getUuid());
if (runningState && !from.getState().equals(SiteState.ACTIVE)) {
// check if dbsvc are up
SiteMonitorResult monitorResult = drUtil.getCoordinator().getTargetInfo(from.getUuid(), SiteMonitorResult.class);
if (monitorResult != null && monitorResult.getDbQuorumLostSince() > 0) {
runningState = false;
}
}
to.setRunningState(runningState);
return to;
}
use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.
the class DisasterRecovery method create.
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void create() {
for (SiteRestRep site : DisasterRecoveryUtils.getSites()) {
if (SiteState.STANDBY_PAUSED.toString().equals(site.getState())) {
continue;
}
SiteDetailRestRep detail = DisasterRecoveryUtils.getSiteDetails(site.getUuid());
if (!ClusterInfo.ClusterState.STABLE.toString().equals(detail.getClusterState())) {
flash.error(MessagesUtils.get(ADD_WARNING, site.getName()));
list();
}
}
DisasterRecoveryForm site = new DisasterRecoveryForm();
edit(site);
}
use of com.emc.storageos.model.dr.SiteRestRep 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