Search in sources :

Example 1 with VirtualPoolRemoteMirrorProtectionParam

use of com.emc.storageos.model.vpool.VirtualPoolRemoteMirrorProtectionParam in project coprhd-controller by CoprHD.

the class PlacementPolicyValidator method validateProtection.

/**
 * Validates protection
 * Array affinity policy cannot be used for VPool with RP or remote copies
 *
 * @param protectionParam BlockVirtualPoolProtectionParam
 */
private void validateProtection(BlockVirtualPoolProtectionParam protectionParam) {
    if (protectionParam != null) {
        VirtualPoolProtectionRPParam rpParam = protectionParam.getRecoverPoint();
        if (rpParam != null) {
            if (!CollectionUtils.isEmpty(rpParam.getCopies())) {
                throw APIException.badRequests.arrayAffinityPlacementPolicyNotAllowedForRPOrRemoteCopies();
            }
            ProtectionSourcePolicy rpPolicy = rpParam.getSourcePolicy();
            if (rpPolicy != null && (rpPolicy.getJournalSize() != null || rpPolicy.getJournalVarray() != null || rpPolicy.getJournalVpool() != null || rpPolicy.getRemoteCopyMode() != null || rpPolicy.getRpoType() != null || rpPolicy.getRpoValue() != null || rpPolicy.getStandbyJournalVarray() != null || rpPolicy.getStandbyJournalVpool() != null)) {
                throw APIException.badRequests.arrayAffinityPlacementPolicyNotAllowedForRPOrRemoteCopies();
            }
        }
        VirtualPoolRemoteMirrorProtectionParam remoteProtection = protectionParam.getRemoteCopies();
        if (remoteProtection != null) {
            if (!CollectionUtils.isEmpty(remoteProtection.getRemoteCopySettings())) {
                throw APIException.badRequests.arrayAffinityPlacementPolicyNotAllowedForRPOrRemoteCopies();
            }
        }
    }
}
Also used : VirtualPoolProtectionRPParam(com.emc.storageos.model.vpool.VirtualPoolProtectionRPParam) ProtectionSourcePolicy(com.emc.storageos.model.vpool.ProtectionSourcePolicy) VirtualPoolRemoteMirrorProtectionParam(com.emc.storageos.model.vpool.VirtualPoolRemoteMirrorProtectionParam)

Example 2 with VirtualPoolRemoteMirrorProtectionParam

use of com.emc.storageos.model.vpool.VirtualPoolRemoteMirrorProtectionParam in project coprhd-controller by CoprHD.

the class BlockVirtualPoolForm method doLoad.

protected void doLoad(BlockVirtualPoolRestRep virtualPool) {
    loadCommon(virtualPool);
    minPaths = virtualPool.getMinPaths();
    maxPaths = virtualPool.getMaxPaths();
    initiatorPaths = virtualPool.getPathsPerInitiator();
    driveType = virtualPool.getDriveType();
    autoTierPolicy = virtualPool.getAutoTieringPolicyName();
    enableCompression = virtualPool.getCompressionEnabled();
    expandable = virtualPool.getExpandable();
    fastExpansion = virtualPool.getFastExpansion();
    multiVolumeConsistency = virtualPool.getMultiVolumeConsistent();
    thinPreAllocationPercent = virtualPool.getThinVolumePreAllocationPercentage();
    uniqueAutoTierPolicyNames = virtualPool.getUniquePolicyNames();
    raidLevels = defaultSet(virtualPool.getRaidLevels());
    hostIOLimitBandwidth = virtualPool.getHostIOLimitBandwidth();
    hostIOLimitIOPs = virtualPool.getHostIOLimitIOPs();
    enableDeDup = virtualPool.getDedupCapable();
    placementPolicy = virtualPool.getPlacementPolicy();
    VirtualPoolHighAvailabilityParam highAvailabilityType = virtualPool.getHighAvailability();
    if (highAvailabilityType != null && HighAvailability.isHighAvailability(highAvailabilityType.getType())) {
        highAvailability = highAvailabilityType.getType();
        if (highAvailability.equals(HighAvailability.VPLEX_LOCAL)) {
            protectSourceSite = true;
        }
        enableAutoCrossConnExport = highAvailabilityType.getAutoCrossConnectExport();
        if (highAvailabilityType.getHaVirtualArrayVirtualPool() != null) {
            haVirtualArray = asString(highAvailabilityType.getHaVirtualArrayVirtualPool().getVirtualArray());
            haVirtualPool = asString(highAvailabilityType.getHaVirtualArrayVirtualPool().getVirtualPool());
            Boolean activeProtectionAtHASite = Boolean.TRUE.equals(highAvailabilityType.getHaVirtualArrayVirtualPool().getActiveProtectionAtHASite());
            Boolean metroPoint = Boolean.TRUE.equals(highAvailabilityType.getMetroPoint());
            if (metroPoint) {
                protectSourceSite = true;
                protectHASite = true;
                if (activeProtectionAtHASite) {
                    activeSite = HighAvailability.VPLEX_HA.toString();
                } else {
                    activeSite = HighAvailability.VPLEX_SOURCE.toString();
                    protectSourceSite = true;
                }
            } else {
                protectHASite = activeProtectionAtHASite;
                protectSourceSite = !protectHASite;
            }
        } else {
            protectSourceSite = true;
        }
    } else {
        protectSourceSite = true;
    }
    BlockVirtualPoolProtectionParam protection = virtualPool.getProtection();
    if (protection != null) {
        if (protection.getSnapshots() != null) {
            maxSnapshots = protection.getSnapshots().getMaxSnapshots();
        }
        if (protection.getContinuousCopies() != null) {
            maxContinuousCopies = protection.getContinuousCopies().getMaxMirrors();
            continuousCopyVirtualPool = asString(protection.getContinuousCopies().getVpool());
        }
        VirtualPoolProtectionRPParam recoverPoint = protection.getRecoverPoint();
        if (recoverPoint != null) {
            remoteProtection = ProtectionSystemTypes.RECOVERPOINT;
            ProtectionSourcePolicy sourcePolicy = recoverPoint.getSourcePolicy();
            if (sourcePolicy != null) {
                String journalSize = sourcePolicy.getJournalSize();
                rpJournalSizeUnit = RPCopyForm.parseJournalSizeUnit(journalSize);
                rpJournalSize = StringUtils.defaultIfBlank(RPCopyForm.parseJournalSize(journalSize, rpJournalSizeUnit), RPCopyForm.JOURNAL_SIZE_MIN);
                rpRemoteCopyMode = sourcePolicy.getRemoteCopyMode();
                rpRpoValue = sourcePolicy.getRpoValue();
                rpRpoType = sourcePolicy.getRpoType();
                if (protectHASite != null && protectSourceSite != null && protectHASite && protectSourceSite) {
                    // Backend will take care of swapping
                    // if(activeSite.equalsIgnoreCase(HighAvailability.VPLEX_SOURCE)){
                    sourceJournalVArray = asString(sourcePolicy.getJournalVarray());
                    sourceJournalVPool = asString(sourcePolicy.getJournalVpool());
                    haJournalVArray = asString(sourcePolicy.getStandbyJournalVarray());
                    haJournalVPool = asString(sourcePolicy.getStandbyJournalVpool());
                } else {
                    if (protectHASite != null && protectHASite) {
                        haJournalVArray = asString(sourcePolicy.getJournalVarray());
                        haJournalVPool = asString(sourcePolicy.getJournalVpool());
                    } else if (protectSourceSite != null && protectSourceSite) {
                        sourceJournalVArray = asString(sourcePolicy.getJournalVarray());
                        sourceJournalVPool = asString(sourcePolicy.getJournalVpool());
                    }
                }
            }
            List<RPCopyForm> rpCopyForms = Lists.newArrayList();
            for (VirtualPoolProtectionVirtualArraySettingsParam copy : recoverPoint.getCopies()) {
                RPCopyForm rpCopy = new RPCopyForm();
                rpCopy.load(copy);
                rpCopyForms.add(rpCopy);
            }
            rpCopies = rpCopyForms.toArray(new RPCopyForm[0]);
            rpCopiesJson = new Gson().toJson(rpCopies);
        }
        VirtualPoolRemoteMirrorProtectionParam srdf = protection.getRemoteCopies();
        if (srdf != null) {
            remoteProtection = ProtectionSystemTypes.SRDF;
            List<SrdfCopyForm> copyForms = Lists.newArrayList();
            for (VirtualPoolRemoteProtectionVirtualArraySettingsParam copy : srdf.getRemoteCopySettings()) {
                srdfCopyMode = copy.getRemoteCopyMode();
                SrdfCopyForm srdfCopyForm = new SrdfCopyForm();
                srdfCopyForm.load(copy);
                copyForms.add(srdfCopyForm);
            }
            srdfCopies = copyForms.toArray(new SrdfCopyForm[0]);
            Gson gson = new Gson();
            srdfCopiesJson = gson.toJson(srdfCopies);
        } else {
            srdfCopiesJson = "[]";
        }
    }
}
Also used : VirtualPoolRemoteProtectionVirtualArraySettingsParam(com.emc.storageos.model.vpool.VirtualPoolRemoteProtectionVirtualArraySettingsParam) BlockVirtualPoolProtectionParam(com.emc.storageos.model.vpool.BlockVirtualPoolProtectionParam) VirtualPoolProtectionRPParam(com.emc.storageos.model.vpool.VirtualPoolProtectionRPParam) Gson(com.google.gson.Gson) ResourceUtils.asString(com.emc.vipr.client.core.util.ResourceUtils.asString) VirtualPoolRemoteMirrorProtectionParam(com.emc.storageos.model.vpool.VirtualPoolRemoteMirrorProtectionParam) VirtualPoolProtectionVirtualArraySettingsParam(com.emc.storageos.model.vpool.VirtualPoolProtectionVirtualArraySettingsParam) ProtectionSourcePolicy(com.emc.storageos.model.vpool.ProtectionSourcePolicy) VirtualPoolHighAvailabilityParam(com.emc.storageos.model.vpool.VirtualPoolHighAvailabilityParam)

Example 3 with VirtualPoolRemoteMirrorProtectionParam

use of com.emc.storageos.model.vpool.VirtualPoolRemoteMirrorProtectionParam in project coprhd-controller by CoprHD.

the class VirtualPoolMapper method toBlockVirtualPool.

public static BlockVirtualPoolRestRep toBlockVirtualPool(DbClient dbclient, VirtualPool from, Map<URI, VpoolProtectionVarraySettings> protectionSettings, Map<URI, VpoolRemoteCopyProtectionSettings> remoteProtectionSettings) {
    if (from == null) {
        return null;
    }
    BlockVirtualPoolRestRep to = new BlockVirtualPoolRestRep();
    to.setDriveType(from.getDriveType());
    to.setAutoTieringPolicyName(from.getAutoTierPolicyName());
    to.setCompressionEnabled(from.getCompressionEnabled());
    to.setThinVolumePreAllocationPercentage(from.getThinVolumePreAllocationPercentage());
    to.setExpandable(from.getExpandable());
    to.setFastExpansion(from.getFastExpansion());
    to.setMultiVolumeConsistent(from.getMultivolumeConsistency());
    to.setUniquePolicyNames(from.getUniquePolicyNames());
    to.setMaxPaths(from.getNumPaths());
    to.setMinPaths(from.getMinPaths());
    to.setPathsPerInitiator(from.getPathsPerInitiator());
    to.setHostIOLimitBandwidth(from.getHostIOLimitBandwidth());
    to.setHostIOLimitIOPs(from.getHostIOLimitIOPs());
    to.setPlacementPolicy(from.getPlacementPolicy());
    if (from.getArrayInfo() != null) {
        StringSetMap arrayInfo = from.getArrayInfo();
        // Raid Levels
        StringSet raidLevels = arrayInfo.get(VirtualPoolCapabilityValuesWrapper.RAID_LEVEL);
        if (raidLevels != null) {
            to.setRaidLevels(raidLevels);
        }
    }
    BlockVirtualPoolProtectionParam protection = new BlockVirtualPoolProtectionParam();
    // mirror logic
    protection.setContinuousCopies(new VirtualPoolProtectionMirrorParam());
    if (NullColumnValueGetter.isNotNullValue(from.getMirrorVirtualPool())) {
        protection.getContinuousCopies().setVpool(URI.create(from.getMirrorVirtualPool()));
    }
    protection.getContinuousCopies().setMaxMirrors(from.getMaxNativeContinuousCopies());
    // SRDF logic
    if (null != remoteProtectionSettings && !remoteProtectionSettings.isEmpty()) {
        protection.setRemoteCopies(new VirtualPoolRemoteMirrorProtectionParam());
        protection.getRemoteCopies().setRemoteCopySettings(new ArrayList<VirtualPoolRemoteProtectionVirtualArraySettingsParam>());
        for (Map.Entry<URI, VpoolRemoteCopyProtectionSettings> remoteSetting : remoteProtectionSettings.entrySet()) {
            VirtualPoolRemoteProtectionVirtualArraySettingsParam remoteCopy = new VirtualPoolRemoteProtectionVirtualArraySettingsParam();
            remoteCopy.setRemoteCopyMode(remoteSetting.getValue().getCopyMode());
            remoteCopy.setVarray(remoteSetting.getValue().getVirtualArray());
            remoteCopy.setVpool(remoteSetting.getValue().getVirtualPool());
            protection.getRemoteCopies().getRemoteCopySettings().add(remoteCopy);
        }
    }
    // RP logic
    if (protectionSettings != null && !protectionSettings.isEmpty()) {
        protection.setRecoverPoint(new VirtualPoolProtectionRPParam());
        if (isNotNullValue(from.getJournalSize())) {
            if (protection.getRecoverPoint().getSourcePolicy() == null) {
                protection.getRecoverPoint().setSourcePolicy(new ProtectionSourcePolicy());
            }
            protection.getRecoverPoint().getSourcePolicy().setJournalSize(from.getJournalSize());
        }
        if (isNotNullValue(from.getJournalVarray())) {
            if (protection.getRecoverPoint().getSourcePolicy() == null) {
                protection.getRecoverPoint().setSourcePolicy(new ProtectionSourcePolicy());
            }
            protection.getRecoverPoint().getSourcePolicy().setJournalVarray(URI.create(from.getJournalVarray()));
        }
        if (isNotNullValue(from.getJournalVpool())) {
            if (protection.getRecoverPoint().getSourcePolicy() == null) {
                protection.getRecoverPoint().setSourcePolicy(new ProtectionSourcePolicy());
            }
            protection.getRecoverPoint().getSourcePolicy().setJournalVpool(URI.create(from.getJournalVpool()));
        }
        if (isNotNullValue(from.getStandbyJournalVarray())) {
            if (protection.getRecoverPoint().getSourcePolicy() == null) {
                protection.getRecoverPoint().setSourcePolicy(new ProtectionSourcePolicy());
            }
            protection.getRecoverPoint().getSourcePolicy().setStandbyJournalVarray(URI.create(from.getStandbyJournalVarray()));
        }
        if (isNotNullValue(from.getStandbyJournalVpool())) {
            if (protection.getRecoverPoint().getSourcePolicy() == null) {
                protection.getRecoverPoint().setSourcePolicy(new ProtectionSourcePolicy());
            }
            protection.getRecoverPoint().getSourcePolicy().setStandbyJournalVpool(URI.create(from.getStandbyJournalVpool()));
        }
        if (isNotNullValue(from.getRpCopyMode())) {
            if (protection.getRecoverPoint().getSourcePolicy() == null) {
                protection.getRecoverPoint().setSourcePolicy(new ProtectionSourcePolicy());
            }
            protection.getRecoverPoint().getSourcePolicy().setRemoteCopyMode(from.getRpCopyMode());
        }
        if (isNotNullValue(from.getRpRpoType())) {
            if (protection.getRecoverPoint().getSourcePolicy() == null) {
                protection.getRecoverPoint().setSourcePolicy(new ProtectionSourcePolicy());
            }
            protection.getRecoverPoint().getSourcePolicy().setRpoType(from.getRpRpoType());
        }
        if (from.checkRpRpoValueSet()) {
            if (protection.getRecoverPoint().getSourcePolicy() == null) {
                protection.getRecoverPoint().setSourcePolicy(new ProtectionSourcePolicy());
            }
            protection.getRecoverPoint().getSourcePolicy().setRpoValue(from.getRpRpoValue());
        }
        protection.getRecoverPoint().setCopies(new HashSet<VirtualPoolProtectionVirtualArraySettingsParam>());
        for (Map.Entry<URI, VpoolProtectionVarraySettings> setting : protectionSettings.entrySet()) {
            VirtualPoolProtectionVirtualArraySettingsParam copy = new VirtualPoolProtectionVirtualArraySettingsParam();
            VpoolProtectionVarraySettings value = setting.getValue();
            if (value != null) {
                copy.setVpool(setting.getValue().getVirtualPool());
                copy.setVarray(setting.getKey());
                copy.setCopyPolicy(new ProtectionCopyPolicy());
                copy.getCopyPolicy().setJournalSize(setting.getValue().getJournalSize());
                copy.getCopyPolicy().setJournalVarray(setting.getValue().getJournalVarray());
                copy.getCopyPolicy().setJournalVpool(setting.getValue().getJournalVpool());
                protection.getRecoverPoint().getCopies().add(copy);
            }
        }
    }
    // Show the feature even if it's disabled
    protection.setSnapshots(new VirtualPoolProtectionSnapshotsParam());
    protection.getSnapshots().setMaxSnapshots(from.getMaxNativeSnapshots());
    if (protection.hasAnyProtection()) {
        to.setProtection(protection);
    }
    // VPLEX logic
    if (isNotNullValue(from.getHighAvailability())) {
        VirtualPoolHighAvailabilityParam haParam = new VirtualPoolHighAvailabilityParam(from.getHighAvailability());
        // Set the MetroPoint field.
        haParam.setMetroPoint(from.getMetroPoint());
        haParam.setAutoCrossConnectExport(from.getAutoCrossConnectExport());
        StringMap haVarrayVpoolMap = from.getHaVarrayVpoolMap();
        if ((haVarrayVpoolMap != null) && (haVarrayVpoolMap.size() != 0)) {
            VirtualPoolHighAvailabilityParam.VirtualArrayVirtualPoolMapEntry varrayVpoolMapEntry = null;
            for (Map.Entry<String, String> entry : haVarrayVpoolMap.entrySet()) {
                URI vpoolUri = null;
                // Logic to ensure "null" doesn't get displayed as the HA vpool.
                if (isNotNullValue(entry.getValue())) {
                    vpoolUri = URI.create(entry.getValue());
                }
                if (entry.getKey() != null && !entry.getKey().isEmpty()) {
                    varrayVpoolMapEntry = new VirtualPoolHighAvailabilityParam.VirtualArrayVirtualPoolMapEntry(URI.create(entry.getKey()), vpoolUri);
                }
                if (isNotNullValue(from.getHaVarrayConnectedToRp()) && !from.getHaVarrayConnectedToRp().isEmpty()) {
                    varrayVpoolMapEntry.setActiveProtectionAtHASite(true);
                } else {
                    varrayVpoolMapEntry.setActiveProtectionAtHASite(false);
                }
                haParam.setHaVirtualArrayVirtualPool(varrayVpoolMapEntry);
                if (vpoolUri != null) {
                    VirtualPool haVpool = dbclient.queryObject(VirtualPool.class, vpoolUri);
                    if (haVpool != null) {
                        if (haVpool.getMirrorVirtualPool() != null) {
                            protection.getContinuousCopies().setHaVpool(URI.create(haVpool.getMirrorVirtualPool()));
                        }
                        protection.getContinuousCopies().setHaMaxMirrors(haVpool.getMaxNativeContinuousCopies());
                    }
                }
            }
        }
        to.setHighAvailability(haParam);
    }
    // dedup capability
    if (from.getDedupCapable() != null) {
        to.setDedupCapable(from.getDedupCapable());
    }
    return mapVirtualPoolFields(from, to, protectionSettings);
}
Also used : VirtualPoolRemoteProtectionVirtualArraySettingsParam(com.emc.storageos.model.vpool.VirtualPoolRemoteProtectionVirtualArraySettingsParam) VpoolRemoteCopyProtectionSettings(com.emc.storageos.db.client.model.VpoolRemoteCopyProtectionSettings) StringMap(com.emc.storageos.db.client.model.StringMap) BlockVirtualPoolProtectionParam(com.emc.storageos.model.vpool.BlockVirtualPoolProtectionParam) VirtualPoolProtectionRPParam(com.emc.storageos.model.vpool.VirtualPoolProtectionRPParam) ProtectionCopyPolicy(com.emc.storageos.model.vpool.ProtectionCopyPolicy) URI(java.net.URI) StringSet(com.emc.storageos.db.client.model.StringSet) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) ProtectionSourcePolicy(com.emc.storageos.model.vpool.ProtectionSourcePolicy) VirtualPoolProtectionMirrorParam(com.emc.storageos.model.vpool.VirtualPoolProtectionMirrorParam) StringSetMap(com.emc.storageos.db.client.model.StringSetMap) VpoolProtectionVarraySettings(com.emc.storageos.db.client.model.VpoolProtectionVarraySettings) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) VirtualPoolRemoteMirrorProtectionParam(com.emc.storageos.model.vpool.VirtualPoolRemoteMirrorProtectionParam) VirtualPoolProtectionSnapshotsParam(com.emc.storageos.model.vpool.VirtualPoolProtectionSnapshotsParam) VirtualPoolProtectionVirtualArraySettingsParam(com.emc.storageos.model.vpool.VirtualPoolProtectionVirtualArraySettingsParam) Map(java.util.Map) StringSetMap(com.emc.storageos.db.client.model.StringSetMap) StringMap(com.emc.storageos.db.client.model.StringMap) VirtualPoolHighAvailabilityParam(com.emc.storageos.model.vpool.VirtualPoolHighAvailabilityParam)

Aggregations

ProtectionSourcePolicy (com.emc.storageos.model.vpool.ProtectionSourcePolicy)3 VirtualPoolProtectionRPParam (com.emc.storageos.model.vpool.VirtualPoolProtectionRPParam)3 VirtualPoolRemoteMirrorProtectionParam (com.emc.storageos.model.vpool.VirtualPoolRemoteMirrorProtectionParam)3 BlockVirtualPoolProtectionParam (com.emc.storageos.model.vpool.BlockVirtualPoolProtectionParam)2 VirtualPoolHighAvailabilityParam (com.emc.storageos.model.vpool.VirtualPoolHighAvailabilityParam)2 VirtualPoolProtectionVirtualArraySettingsParam (com.emc.storageos.model.vpool.VirtualPoolProtectionVirtualArraySettingsParam)2 VirtualPoolRemoteProtectionVirtualArraySettingsParam (com.emc.storageos.model.vpool.VirtualPoolRemoteProtectionVirtualArraySettingsParam)2 StringMap (com.emc.storageos.db.client.model.StringMap)1 StringSet (com.emc.storageos.db.client.model.StringSet)1 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)1 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)1 VpoolProtectionVarraySettings (com.emc.storageos.db.client.model.VpoolProtectionVarraySettings)1 VpoolRemoteCopyProtectionSettings (com.emc.storageos.db.client.model.VpoolRemoteCopyProtectionSettings)1 BlockVirtualPoolRestRep (com.emc.storageos.model.vpool.BlockVirtualPoolRestRep)1 ProtectionCopyPolicy (com.emc.storageos.model.vpool.ProtectionCopyPolicy)1 VirtualPoolProtectionMirrorParam (com.emc.storageos.model.vpool.VirtualPoolProtectionMirrorParam)1 VirtualPoolProtectionSnapshotsParam (com.emc.storageos.model.vpool.VirtualPoolProtectionSnapshotsParam)1 ResourceUtils.asString (com.emc.vipr.client.core.util.ResourceUtils.asString)1 Gson (com.google.gson.Gson)1 URI (java.net.URI)1