use of com.emc.storageos.model.dr.SiteActive in project coprhd-controller by CoprHD.
the class DisasterRecoveryService method checkIsActive.
/**
* Check if current site is active site
*
* @brief Check if current site is active
* @return SiteActive true if current site is active else false
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/active")
public SiteActive checkIsActive() {
log.info("Begin to check if site Active or Standby");
SiteActive isActiveSite = new SiteActive();
try {
Site localSite = drUtil.getLocalSite();
isActiveSite.setIsActive(localSite.getState() == SiteState.ACTIVE);
isActiveSite.setLocalSiteName(localSite.getName());
isActiveSite.setLocalUuid(localSite.getUuid());
isActiveSite.setIsMultiSite(drUtil.isMultisite());
return isActiveSite;
} catch (Exception e) {
log.error("Can't get site is Active or Standby");
throw APIException.badRequests.siteIdNotFound();
}
}
use of com.emc.storageos.model.dr.SiteActive in project coprhd-controller by CoprHD.
the class DisasterRecovery method switchover.
@FlashException("list")
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void switchover(String id) {
String standby_name = null;
String standby_vip = null;
String active_name = null;
Boolean isSwitchover = false;
// Get active site details
SiteRestRep activesite = DisasterRecoveryUtils.getActiveSite();
active_name = activesite == null ? "N/A" : activesite.getName();
SiteRestRep result = DisasterRecoveryUtils.getSite(id);
if (result != null) {
// Check Switchover or Failover
SiteActive currentSite = DisasterRecoveryUtils.checkActiveSite();
if (currentSite.getIsActive() == true) {
DisasterRecoveryUtils.doSwitchover(id);
isSwitchover = true;
} else {
DisasterRecoveryUtils.doFailover(id);
isSwitchover = false;
}
standby_name = result.getName();
standby_vip = result.getVipEndpoint();
}
String site_uuid = id;
maintenance(active_name, standby_name, standby_vip, site_uuid, isSwitchover);
}
Aggregations