Search in sources :

Example 16 with SiteRestRep

use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.

the class DisasterRecovery method resume.

@FlashException("list")
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN"), @Restrict("SYSTEM_ADMIN"), @Restrict("RESTRICTED_SYSTEM_ADMIN") })
public static void resume(String id) {
    SiteRestRep result = DisasterRecoveryUtils.getSite(id);
    if (result != null) {
        SiteRestRep siteresume = DisasterRecoveryUtils.resumeStandby(id);
        flash.success(MessagesUtils.get(RESUMED_SUCCESS, siteresume.getName()));
    }
    list();
}
Also used : SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) FlashException(controllers.util.FlashException) Restrictions(controllers.deadbolt.Restrictions)

Example 17 with SiteRestRep

use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.

the class DisasterRecovery method edit.

@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void edit(String id) {
    SiteRestRep siteRest = DisasterRecoveryUtils.getSite(id);
    if (siteRest != null) {
        DisasterRecoveryForm disasterRecovery = new DisasterRecoveryForm(siteRest);
        edit(disasterRecovery);
    } else {
        flash.error(MessagesUtils.get(UNKNOWN, id));
        list();
    }
}
Also used : SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) Restrictions(controllers.deadbolt.Restrictions)

Example 18 with SiteRestRep

use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.

the class DisasterRecovery method retry.

@FlashException("list")
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN"), @Restrict("SYSTEM_ADMIN"), @Restrict("RESTRICTED_SYSTEM_ADMIN") })
public static void retry(String id) {
    SiteRestRep result = DisasterRecoveryUtils.getSite(id);
    if (result != null) {
        SiteRestRep siteretry = DisasterRecoveryUtils.retryStandby(id);
        if (siteretry.getState().equals(SiteState.STANDBY_FAILING_OVER.name())) {
            String standby_name = siteretry.getName();
            String standby_vip = siteretry.getVipEndpoint();
            String active_name = null;
            for (SiteRestRep site : DisasterRecoveryUtils.getStandbySites()) {
                if (site.getState().equals(SiteState.ACTIVE_FAILING_OVER.name()) || site.getState().equals(SiteState.ACTIVE_DEGRADED.name())) {
                    active_name = site.getName();
                    break;
                }
            }
            Boolean isSwitchover = false;
            String site_uuid = id;
            maintenance(active_name, standby_name, standby_vip, site_uuid, isSwitchover);
        } else {
            flash.success(MessagesUtils.get(RETRY_SUCCESS, siteretry.getName()));
            list();
        }
    } else {
        flash.error(MessagesUtils.get(UNKNOWN, id));
        list();
    }
}
Also used : SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) FlashException(controllers.util.FlashException) Restrictions(controllers.deadbolt.Restrictions)

Example 19 with SiteRestRep

use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.

the class DisasterRecovery method save.

@FlashException(keep = true, referrer = { "create", "edit" })
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void save(DisasterRecoveryForm disasterRecovery) {
    if (disasterRecovery != null) {
        disasterRecovery.validate("disasterRecovery");
        if (Validation.hasErrors()) {
            Common.handleError();
        }
        if (disasterRecovery.isNew()) {
            SiteAddParam standbySite = new SiteAddParam();
            standbySite.setName(disasterRecovery.name);
            standbySite.setVip(disasterRecovery.VirtualIP);
            standbySite.setUsername(disasterRecovery.userName);
            standbySite.setPassword(disasterRecovery.userPassword);
            standbySite.setDescription(disasterRecovery.description);
            SiteRestRep result = DisasterRecoveryUtils.addStandby(standbySite);
            flash.success(MessagesUtils.get(SAVED_SUCCESS, result.getName()));
            list();
        } else {
            SiteUpdateParam siteUpdateParam = new SiteUpdateParam();
            siteUpdateParam.setName(disasterRecovery.name);
            siteUpdateParam.setDescription(disasterRecovery.description);
            DisasterRecoveryUtils.updateSite(disasterRecovery.id, siteUpdateParam);
            flash.success(MessagesUtils.get(UPDATE_SUCCESS, disasterRecovery.name));
            list();
        }
    }
}
Also used : SiteAddParam(com.emc.storageos.model.dr.SiteAddParam) SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) SiteUpdateParam(com.emc.storageos.model.dr.SiteUpdateParam) FlashException(controllers.util.FlashException) Restrictions(controllers.deadbolt.Restrictions)

Example 20 with SiteRestRep

use of com.emc.storageos.model.dr.SiteRestRep in project coprhd-controller by CoprHD.

the class Upgrade method clusterStatus.

public static void clusterStatus() {
    ClusterInfo clusterInfo = getSysClient().upgrade().getClusterInfo();
    Collection<String> repositoryVersions = clusterInfo.getTargetState().getAvailable();
    Collection<String> newVersions = clusterInfo.getNewVersions() == null ? Collections.<String>emptyList() : clusterInfo.getNewVersions();
    String clusterState = calculateClusterState(clusterInfo);
    boolean isStable = clusterState.equalsIgnoreCase(ClusterInfo.ClusterState.STABLE.toString());
    boolean isWorking = !isStable && !clusterState.equalsIgnoreCase(ClusterInfo.ClusterState.UNKNOWN.toString());
    boolean isDownloading = clusterState.equals(DOWNLOADING_CLUSTER_STATE) || isStandbySiteDownloading();
    DbConsistencyStatusRestRep checkDbState = getSysClient().upgrade().getDbCheckState();
    String isDbCheckStatus = checkDbState.getStatus().toString();
    int checkProgress = checkDbState.getProgress();
    Map<String, Map<String, DownloadStatus>> downloadStatus = Maps.newLinkedHashMap();
    if (isDownloading) {
        SiteRestRep activeSite = DisasterRecoveryUtils.getActiveSite();
        DownloadProgress downloadProgress = getSysClient().upgrade().getDownloadProgress();
        downloadStatus.put(activeSite.getName(), calculateDownloadStatus(downloadProgress));
        for (SiteRestRep standby : DisasterRecoveryUtils.getStandbySites()) {
            downloadProgress = getSysClient().upgrade().getDownloadProgress(standby.getUuid());
            downloadStatus.put(standby.getName(), calculateDownloadStatus(downloadProgress));
        }
    }
    render(clusterInfo, clusterState, newVersions, repositoryVersions, isStable, isWorking, isDownloading, downloadStatus, checkProgress, isDbCheckStatus);
}
Also used : DbConsistencyStatusRestRep(com.emc.storageos.model.db.DbConsistencyStatusRestRep) ClusterInfo(com.emc.vipr.model.sys.ClusterInfo) SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) DownloadProgress(com.emc.vipr.model.sys.DownloadProgress) Map(java.util.Map)

Aggregations

SiteRestRep (com.emc.storageos.model.dr.SiteRestRep)21 Restrictions (controllers.deadbolt.Restrictions)7 Test (org.junit.Test)5 FlashException (controllers.util.FlashException)4 ArrayList (java.util.ArrayList)3 Site (com.emc.storageos.coordinator.client.model.Site)2 SiteState (com.emc.storageos.coordinator.client.model.SiteState)2 Configuration (com.emc.storageos.coordinator.common.Configuration)2 SiteAddParam (com.emc.storageos.model.dr.SiteAddParam)2 SiteDetailRestRep (com.emc.storageos.model.dr.SiteDetailRestRep)2 DownloadProgress (com.emc.vipr.model.sys.DownloadProgress)2 Date (java.util.Date)2 Map (java.util.Map)2 Matchers.anyString (org.mockito.Matchers.anyString)2 InternalSiteServiceClient (com.emc.storageos.api.service.impl.resource.utils.InternalSiteServiceClient)1 PropertyInfoExt (com.emc.storageos.coordinator.client.model.PropertyInfoExt)1 SiteInfo (com.emc.storageos.coordinator.client.model.SiteInfo)1 SiteMonitorResult (com.emc.storageos.coordinator.client.model.SiteMonitorResult)1 NetworkHealth (com.emc.storageos.coordinator.client.model.SiteNetworkState.NetworkHealth)1 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)1