use of com.emc.storageos.model.dr.SiteRemoved 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;
}
Aggregations