use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.
the class DisasterRecoveryServiceTest method testFindRecommendFailoverSite.
@Test
public void testFindRecommendFailoverSite() {
// only one synced site
standbySite1.setState(SiteState.STANDBY_SYNCED);
List<SiteRestRep> responseSiteFromRemote = new ArrayList<SiteRestRep>();
SiteRestRep recommendSite = drService.findRecommendFailoverSite(responseSiteFromRemote, standbySite1);
assertEquals(recommendSite.getUuid(), standbySite1.getUuid());
// only one paused site
standbySite1.setState(SiteState.STANDBY_PAUSED);
responseSiteFromRemote = new ArrayList<SiteRestRep>();
recommendSite = drService.findRecommendFailoverSite(responseSiteFromRemote, standbySite1);
assertEquals(recommendSite.getUuid(), standbySite1.getUuid());
// one paused, two synced
responseSiteFromRemote = new ArrayList<SiteRestRep>();
SiteRestRep site1 = new SiteRestRep();
site1.setUuid("standby1");
site1.setState(SiteState.STANDBY_SYNCED.toString());
responseSiteFromRemote.add(site1);
SiteRestRep site2 = new SiteRestRep();
site2.setUuid("standby2");
site2.setState(SiteState.STANDBY_SYNCED.toString());
responseSiteFromRemote.add(site2);
recommendSite = drService.findRecommendFailoverSite(responseSiteFromRemote, standbySite1);
assertEquals(recommendSite.getUuid(), site1.getUuid());
// 3 paused
responseSiteFromRemote = new ArrayList<SiteRestRep>();
site1.setState(SiteState.STANDBY_PAUSED.toString());
responseSiteFromRemote.add(site1);
site2.setState(SiteState.STANDBY_PAUSED.toString());
responseSiteFromRemote.add(site2);
standbySite1.setLastStateUpdateTime((new Date()).getTime() + 1000);
recommendSite = drService.findRecommendFailoverSite(responseSiteFromRemote, standbySite1);
assertEquals(recommendSite.getUuid(), standbySite1.getUuid());
}
use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.
the class DisasterRecoveryServiceTest method testGetStandby.
@Test
public void testGetStandby() throws Exception {
doReturn(standbySite1).when(drUtil).getSiteFromLocalVdc(standbySite1.getUuid());
SiteRestRep response = drService.getSite("site-uuid-1");
compareSiteResponse(response, standbySite1);
}
use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.
the class DisasterRecoveryServiceTest method testGetStandby_NotBelongLocalVDC.
@Test
public void testGetStandby_NotBelongLocalVDC() throws Exception {
doReturn(null).when(coordinator).queryConfiguration(String.format("%s/vdc1", Site.CONFIG_KIND), "site-uuid-not-exist");
SiteRestRep response = drService.getSite("site-uuid-not-exist");
assertNull(response);
}
use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.
the class AdminDashboard method disasterRecovery.
@Restrictions({ @Restrict("SYSTEM_MONITOR"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN"), @Restrict("SYSTEM_ADMIN"), @Restrict("RESTRICTED_SYSTEM_ADMIN") })
public static void disasterRecovery() {
Date disasterRecoveryLastUpdated = AdminDashboardUtils.getNodeHealthListLastUpdated();
List<SiteRestRep> drsites = DisasterRecoveryUtils.getSites();
render(disasterRecoveryLastUpdated, drsites);
}
use of com.emc.storageos.model.dr.SiteRestRep 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