use of com.emc.storageos.model.dr.SiteList in project coprhd-controller by CoprHD.
the class DisasterRecoveryServiceTest method testGetAllStandby.
@Test
public void testGetAllStandby() throws Exception {
List<Site> sites = new ArrayList<>();
sites.add(standbySite1);
sites.add(standbySite2);
sites.add(standbySite3);
doReturn(sites).when(drUtil).listSites();
doReturn(new SiteInfo()).when(coordinator).getTargetInfo(any(String.class), eq(SiteInfo.class));
SiteList responseList = drService.getSites();
assertNotNull(responseList.getSites());
assertEquals(3, responseList.getSites().size());
compareSiteResponse(responseList.getSites().get(0), standbySite1);
compareSiteResponse(responseList.getSites().get(1), standbySite2);
}
use of com.emc.storageos.model.dr.SiteList in project coprhd-controller by CoprHD.
the class InternalSiteServiceClient method getSiteList.
public SiteList getSiteList() {
WebResource rRoot = createRequest(SITE_INTERNAL_LIST);
ClientResponse resp = null;
resp = addSignature(rRoot).get(ClientResponse.class);
SiteList response = resp.getEntity(SiteList.class);
return response;
}
use of com.emc.storageos.model.dr.SiteList in project coprhd-controller by CoprHD.
the class DisasterRecoveryService method isLocalSiteRemoved.
/**
* Check if Local Site Removed
*
* @brief Check if local site is removed
* @return result that indicates whether local site is removed
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/islocalsiteremoved")
public SiteRemoved isLocalSiteRemoved() {
SiteRemoved response = new SiteRemoved();
Site localSite = drUtil.getLocalSite();
if (SiteState.ACTIVE == localSite.getState()) {
return response;
}
for (Site remoteSite : drUtil.listSites()) {
if (remoteSite.getUuid().equals(localSite.getUuid())) {
continue;
}
try (InternalSiteServiceClient client = new InternalSiteServiceClient(remoteSite, coordinator, apiSignatureGenerator)) {
SiteList sites = client.getSiteList();
if (!isActiveSite(remoteSite.getUuid(), sites)) {
continue;
}
if (isSiteContainedBy(localSite.getUuid(), sites)) {
return response;
} else {
log.info("According returned result from current active site {}, local site {} has been removed", remoteSite.getUuid(), localSite.getUuid());
response.setIsRemoved(true);
return response;
}
} catch (Exception e) {
log.warn("Error happened when fetching site list from site {}", remoteSite.getUuid(), e);
continue;
}
}
return response;
}
use of com.emc.storageos.model.dr.SiteList in project coprhd-controller by CoprHD.
the class DisasterRecoveryService method getSites.
/**
* Get all sites including standby and active
*
* @brief Get all standby and active sites of local VDC
* @return site list contains all sites with detail information
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SECURITY_ADMIN, Role.RESTRICTED_SECURITY_ADMIN, Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public SiteList getSites() {
log.info("Begin to list all standby sites of local VDC");
SiteList standbyList = new SiteList();
for (Site site : drUtil.listSites()) {
standbyList.getSites().add(siteMapper.mapWithNetwork(site, drUtil));
}
SiteInfo siteInfo = coordinator.getTargetInfo(coordinator.getSiteId(), SiteInfo.class);
standbyList.setConfigVersion(siteInfo.getVdcConfigVersion());
return standbyList;
}
Aggregations