Search in sources :

Example 81 with FlashException

use of controllers.util.FlashException 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 82 with FlashException

use of controllers.util.FlashException 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 83 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class VirtualDataCenters method save.

@FlashException(keep = true, referrer = { "create", "edit" })
@Restrictions({ @Restrict("SYSTEM_ADMIN"), @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void save(VirtualDataCenterForm vdc) {
    vdc.validate("vdc");
    if (Validation.hasErrors()) {
        Common.handleError();
    }
    if (vdc.isNew()) {
        VirtualDataCenterAddParam vdcToAdd = new VirtualDataCenterAddParam();
        vdcToAdd.setName(vdc.name);
        vdcToAdd.setApiEndpoint(vdc.apiEndpoint);
        vdcToAdd.setDescription(vdc.description);
        vdcToAdd.setSecretKey(vdc.secretKey);
        try {
            vdcToAdd.setCertificateChain(FileUtils.readFileToString(vdc.certChain));
        } catch (Exception e) {
            flash.error(MessagesUtils.get("vdc.certChain.invalid.error"));
            Common.handleError();
        }
        Task<VirtualDataCenterRestRep> task = VirtualDataCenterUtils.create(vdcToAdd);
        flash.put("inProgressTask", task.getTaskResource().getId());
    } else {
        VirtualDataCenterRestRep currentVDC = VirtualDataCenterUtils.get(vdc.id);
        if (currentVDC != null) {
            VirtualDataCenterModifyParam vdcToUpdate = new VirtualDataCenterModifyParam();
            vdcToUpdate.setName(vdc.name);
            vdcToUpdate.setDescription(vdc.description);
            Task<VirtualDataCenterRestRep> task = VirtualDataCenterUtils.update(uri(vdc.id), vdcToUpdate);
            flash.put("inProgressTask", task.getTaskResource().getId());
        }
    }
    Cache.delete(Common.VDCS);
    if (StringUtils.isNotBlank(vdc.referrerUrl)) {
        redirect(vdc.referrerUrl);
    } else {
        list();
    }
}
Also used : VirtualDataCenterRestRep(com.emc.storageos.model.vdc.VirtualDataCenterRestRep) VirtualDataCenterAddParam(com.emc.storageos.model.vdc.VirtualDataCenterAddParam) FlashException(controllers.util.FlashException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) VirtualDataCenterModifyParam(com.emc.storageos.model.vdc.VirtualDataCenterModifyParam) FlashException(controllers.util.FlashException) Restrictions(controllers.deadbolt.Restrictions)

Example 84 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class BlockConsistencyGroups method deleteConsistencyGroup.

@FlashException(referrer = { "consistencyGroupDetails" })
public static void deleteConsistencyGroup(String consistencyGroupId) {
    if (StringUtils.isNotBlank(consistencyGroupId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        Task<BlockConsistencyGroupRestRep> task = client.blockConsistencyGroups().deactivate(uri(consistencyGroupId));
        flash.put("info", MessagesUtils.get("resources.consistencygroup.deactivate"));
    }
    consistencyGroupDetails(consistencyGroupId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockConsistencyGroupRestRep(com.emc.storageos.model.block.BlockConsistencyGroupRestRep) FlashException(controllers.util.FlashException)

Example 85 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class BlockExportGroups method removeInitiator.

@FlashException(referrer = { "exportGroup" })
public static void removeInitiator(String exportGroupId, String initiatorId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    ExportUpdateParam exportUpdateParam = new ExportUpdateParam();
    exportUpdateParam.setInitiators(new InitiatorsUpdateParam());
    Set<URI> remove = Sets.newHashSet();
    remove.add(uri(initiatorId));
    exportUpdateParam.getInitiators().setRemove(remove);
    Task<ExportGroupRestRep> task = client.blockExports().update(uri(exportGroupId), exportUpdateParam);
    flash.put("info", MessagesUtils.get("resources.exportgroup.initiator.removed", task.getOpId()));
    exportGroup(exportGroupId);
}
Also used : InitiatorsUpdateParam(com.emc.storageos.model.block.export.InitiatorsUpdateParam) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) URI(java.net.URI) FlashException(controllers.util.FlashException)

Aggregations

FlashException (controllers.util.FlashException)122 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)45 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)9 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)9 URI (java.net.URI)9 ExportUpdateParam (com.emc.storageos.model.block.export.ExportUpdateParam)8 Restrictions (controllers.deadbolt.Restrictions)8 ArrayList (java.util.ArrayList)7 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)6 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)5 CopiesParam (com.emc.storageos.model.block.CopiesParam)4 SiteRestRep (com.emc.storageos.model.dr.SiteRestRep)4 ExportRule (com.emc.storageos.model.file.ExportRule)4 ExportRules (com.emc.storageos.model.file.ExportRules)4 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)4 ProjectRestRep (com.emc.storageos.model.project.ProjectRestRep)4 ServiceErrorException (com.emc.vipr.client.exceptions.ServiceErrorException)4 JsonArray (com.google.gson.JsonArray)3 JsonObject (com.google.gson.JsonObject)3 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)2