Search in sources :

Example 11 with VirtualPoolRemoteProtectionVirtualArraySettingsParam

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

the class BlockVirtualPoolService method prepareVirtualPool.

// This method must not persist anything to the DB
private VirtualPool prepareVirtualPool(BlockVirtualPoolParam param, Map<URI, VpoolRemoteCopyProtectionSettings> remoteSettingsMap, Map<URI, VpoolProtectionVarraySettings> protectionSettingsMap, List<VpoolProtectionVarraySettings> protectionSettingsList) {
    if (remoteSettingsMap == null) {
        remoteSettingsMap = new HashMap<URI, VpoolRemoteCopyProtectionSettings>();
    }
    if (protectionSettingsMap == null) {
        protectionSettingsMap = new HashMap<URI, VpoolProtectionVarraySettings>();
    }
    if (protectionSettingsList == null) {
        protectionSettingsList = new ArrayList<VpoolProtectionVarraySettings>();
    }
    VirtualPool vpool = new VirtualPool();
    vpool.setType(VirtualPool.Type.block.name());
    // set common VirtualPool parameters.
    populateCommonVirtualPoolCreateParams(vpool, param);
    // By default, mirrors and snaps are disabled
    vpool.setMaxNativeContinuousCopies(VirtualPool.MAX_DISABLED);
    vpool.setMaxNativeSnapshots(VirtualPool.MAX_DISABLED);
    if (param.getThinVolumePreAllocationPercentage() != null) {
        vpool.setThinVolumePreAllocationPercentage(param.getThinVolumePreAllocationPercentage());
    }
    if (param.getMultiVolumeConsistency() != null) {
        vpool.setMultivolumeConsistency(param.getMultiVolumeConsistency());
    }
    StringSetMap arrayInfo = new StringSetMap();
    if (null != param.getRaidLevels()) {
        for (String raidLevel : param.getRaidLevels()) {
            arrayInfo.put(VirtualPoolCapabilityValuesWrapper.RAID_LEVEL, raidLevel);
        }
    }
    if (null != param.getSystemType()) {
        arrayInfo.put(VirtualPoolCapabilityValuesWrapper.SYSTEM_TYPE, param.getSystemType());
    }
    if (arrayInfo.isEmpty()) {
        arrayInfo.put(VirtualPoolCapabilityValuesWrapper.SYSTEM_TYPE, NONE);
    }
    vpool.addArrayInfoDetails(arrayInfo);
    if (param.getProtection() != null) {
        if (param.getProtection().getContinuousCopies() != null) {
            URI ccVpoolURI = param.getProtection().getContinuousCopies().getVpool();
            if (!NullColumnValueGetter.isNullURI(ccVpoolURI)) {
                URI vpoolUri = param.getProtection().getContinuousCopies().getVpool();
                ArgValidator.checkUri(vpoolUri);
                VirtualPool protectionMirrorVpool = _permissionsHelper.getObjectById(vpoolUri, VirtualPool.class);
                ArgValidator.checkEntity(protectionMirrorVpool, vpoolUri, false);
                if (param.getHighAvailability() != null) {
                    validateMirrorVpool(param.getHighAvailability().getType(), protectionMirrorVpool);
                } else {
                    validateMirrorVpool(null, protectionMirrorVpool);
                }
                vpool.setMirrorVirtualPool(vpoolUri.toString());
            }
        }
        if ((param.getProtection().getSnapshots() != null) && (param.getProtection().getSnapshots().getMaxSnapshots() != null)) {
            vpool.setMaxNativeSnapshots(param.getProtection().getSnapshots().getMaxSnapshots());
        }
        if ((param.getProtection().getContinuousCopies() != null) && (param.getProtection().getContinuousCopies().getMaxMirrors() != null)) {
            if (param.getHighAvailability() != null) {
                validateMaxNativeContinuousCopies(param.getProtection().getContinuousCopies().getMaxMirrors(), param.getHighAvailability().getType());
                if (param.getProtection().getContinuousCopies().getVpool() == null && VirtualPool.HighAvailabilityType.vplex_distributed.name().equals(param.getHighAvailability().getType()) && (param.getProtection().getContinuousCopies().getMaxMirrors() > 0)) {
                    throw APIException.badRequests.invalidMirrorVpoolForVplexDistributedVpool();
                }
            }
            vpool.setMaxNativeContinuousCopies(param.getProtection().getContinuousCopies().getMaxMirrors());
        }
        // employ...
        if ((param.getProtection().getRecoverPoint() != null) && (param.getProtection().getRecoverPoint().getCopies() != null)) {
            ProtectionSourcePolicy sourcePolicy = param.getProtection().getRecoverPoint().getSourcePolicy();
            if (sourcePolicy != null) {
                vpool.setJournalSize(sourcePolicy.getJournalSize());
                vpool.setRpRpoValue(sourcePolicy.getRpoValue());
                vpool.setRpRpoType(sourcePolicy.getRpoType());
                vpool.setRpCopyMode(sourcePolicy.getRemoteCopyMode());
                if (!NullColumnValueGetter.isNullURI(sourcePolicy.getJournalVarray())) {
                    vpool.setJournalVarray(sourcePolicy.getJournalVarray().toString());
                    if (!NullColumnValueGetter.isNullURI(sourcePolicy.getJournalVpool())) {
                        vpool.setJournalVpool(sourcePolicy.getJournalVpool().toString());
                    } else {
                        String journalVpoolId = NullColumnValueGetter.getNullStr();
                        if (param.getHighAvailability() == null || Boolean.TRUE.equals(param.getHighAvailability().getMetroPoint())) {
                            // In cases of MetroPoint or when high availability is not specified, default the journal virtual pool
                            // to the parent virtual pool
                            journalVpoolId = vpool.getId().toString();
                        } else if (Boolean.FALSE.equals(param.getHighAvailability().getMetroPoint()) && param.getHighAvailability().getHaVirtualArrayVirtualPool() != null && Boolean.TRUE.equals(param.getHighAvailability().getHaVirtualArrayVirtualPool().getActiveProtectionAtHASite())) {
                            // HA virtual pool.
                            if (param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool() != null) {
                                journalVpoolId = param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool().toString();
                            }
                        } else {
                            // In cases of MetroPoint or when high availability is not specified, default the journal virtual pool
                            // to the parent virtual pool
                            journalVpoolId = vpool.getId().toString();
                        }
                        vpool.setJournalVpool(journalVpoolId);
                    }
                }
                if (param.getHighAvailability() != null && param.getHighAvailability().getMetroPoint() != null && param.getHighAvailability().getMetroPoint()) {
                    if (!NullColumnValueGetter.isNullURI(sourcePolicy.getStandbyJournalVarray())) {
                        vpool.setStandbyJournalVarray(sourcePolicy.getStandbyJournalVarray().toString());
                        if (!NullColumnValueGetter.isNullURI(sourcePolicy.getStandbyJournalVpool())) {
                            vpool.setStandbyJournalVpool(sourcePolicy.getStandbyJournalVpool().toString());
                        }
                    }
                }
            }
            StringMap settingsMap = new StringMap();
            for (VirtualPoolProtectionVirtualArraySettingsParam settingsParam : param.getProtection().getRecoverPoint().getCopies()) {
                VpoolProtectionVarraySettings setting = new VpoolProtectionVarraySettings();
                setting.setId(URIUtil.createId(VpoolProtectionVarraySettings.class));
                setting.setParent(new NamedURI(vpool.getId(), vpool.getLabel()));
                if (settingsParam.getVpool() != null && !String.valueOf(settingsParam.getVpool()).isEmpty()) {
                    setting.setVirtualPool(settingsParam.getVpool());
                }
                if (settingsParam.getCopyPolicy() != null) {
                    setting.setJournalSize(settingsParam.getCopyPolicy().getJournalSize() != null ? settingsParam.getCopyPolicy().getJournalSize() : null);
                    setting.setJournalVarray(settingsParam.getCopyPolicy().getJournalVarray() != null ? settingsParam.getCopyPolicy().getJournalVarray() : settingsParam.getVarray());
                    setting.setJournalVpool(settingsParam.getCopyPolicy().getJournalVpool() != null ? settingsParam.getCopyPolicy().getJournalVpool() : settingsParam.getVpool());
                }
                if (settingsParam.getVarray() != null) {
                    settingsMap.put(settingsParam.getVarray().toString(), setting.getId().toString());
                    protectionSettingsMap.put(settingsParam.getVarray(), setting);
                }
                protectionSettingsList.add(setting);
            }
            vpool.setProtectionVarraySettings(settingsMap);
        }
        // SRDF remote protection Settings
        if (null != param.getProtection().getRemoteCopies() && null != param.getProtection().getRemoteCopies().getRemoteCopySettings()) {
            StringMap remoteCopysettingsMap = new StringMap();
            for (VirtualPoolRemoteProtectionVirtualArraySettingsParam remoteSettings : param.getProtection().getRemoteCopies().getRemoteCopySettings()) {
                VirtualArray remoteVArray = _dbClient.queryObject(VirtualArray.class, remoteSettings.getVarray());
                if (null == remoteVArray || remoteVArray.getInactive()) {
                    throw APIException.badRequests.inactiveRemoteVArrayDetected(remoteSettings.getVarray());
                }
                VpoolRemoteCopyProtectionSettings remoteCopySettingsParam = new VpoolRemoteCopyProtectionSettings();
                remoteCopySettingsParam.setId(URIUtil.createId(VpoolRemoteCopyProtectionSettings.class));
                remoteCopySettingsParam.setVirtualArray(remoteSettings.getVarray());
                if (remoteCopysettingsMap.containsKey(remoteSettings.getVarray().toString())) {
                    throw APIException.badRequests.duplicateRemoteSettingsDetected(remoteSettings.getVarray());
                }
                remoteCopysettingsMap.put(remoteSettings.getVarray().toString(), remoteCopySettingsParam.getId().toString());
                // The remote virtual pool is an optional field. If it is not set, this value will be null and the source
                // virtual pool will be used to provision the target storage for that remote copy.
                remoteCopySettingsParam.setVirtualPool(remoteSettings.getVpool());
                if (null != remoteSettings.getRemoteCopyMode()) {
                    if (!CopyModes.lookup(remoteSettings.getRemoteCopyMode())) {
                        throw APIException.badRequests.invalidCopyMode(remoteSettings.getRemoteCopyMode());
                    }
                    remoteCopySettingsParam.setCopyMode(remoteSettings.getRemoteCopyMode());
                }
                remoteSettingsMap.put(remoteSettings.getVarray(), remoteCopySettingsParam);
            }
            vpool.setProtectionRemoteCopySettings(remoteCopysettingsMap);
        }
    }
    // Validate and set high availability.
    if (param.getHighAvailability() != null) {
        _log.debug("Vpool specifies high availability {}", param.getHighAvailability());
        // High availability type must be specified and valid.
        vpool.setHighAvailability(param.getHighAvailability().getType());
        if (!VirtualPool.vPoolSpecifiesHighAvailability(vpool)) {
            throw APIException.badRequests.requiredParameterMissingOrEmpty("highAvailability.type");
        }
        // Set the MetroPoint value.
        vpool.setMetroPoint(param.getHighAvailability().getMetroPoint());
        // Default if no parameter is supplied is enabled
        if (param.getHighAvailability().getAutoCrossConnectExport() != null) {
            vpool.setAutoCrossConnectExport(param.getHighAvailability().getAutoCrossConnectExport());
        }
        // user may also specify the high availability VirtualPool.
        if (VirtualPool.HighAvailabilityType.vplex_distributed.name().equals(param.getHighAvailability().getType())) {
            if (param.getHighAvailability().getHaVirtualArrayVirtualPool() == null || param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualArray() == null) {
                throw APIException.badRequests.invalidParameterVirtualPoolHighAvailabilityMismatch(param.getHighAvailability().getType());
            }
            // High availability varray must be specified and valid.
            _log.debug("HA varray VirtualPool map specifies the HA varray {}", param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualArray());
            VirtualArray haVarray = _dbClient.queryObject(VirtualArray.class, param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualArray());
            ArgValidator.checkEntity(haVarray, param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualArray(), false);
            String haVarrayId = param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualArray().toString();
            // Check the HA varray VirtualPool, which is not required.
            String haVarrayVpoolId = null;
            if ((param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool() != null) && (!param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool().toString().isEmpty())) {
                _log.debug("HA varray VirtualPool map specifies the HA vpool {}", param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool());
                VirtualPool haVpool = _dbClient.queryObject(VirtualPool.class, param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool());
                ArgValidator.checkEntity(haVpool, param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool(), false);
                haVarrayVpoolId = param.getHighAvailability().getHaVirtualArrayVirtualPool().getVirtualPool().toString();
                // Further validate that this VirtualPool is valid for the
                // specified high availability varray.
                StringSet haVpoolVarrays = haVpool.getVirtualArrays();
                if ((haVpoolVarrays != null) && (!haVpoolVarrays.isEmpty()) && !haVpoolVarrays.contains(haVarrayId)) {
                    throw APIException.badRequests.invalidParameterVirtualPoolNotValidForArray(haVarrayVpoolId, haVarrayId);
                }
            } else {
                _log.debug("HA varray VirtualPool map does not specify HA vpool");
                haVarrayVpoolId = NullColumnValueGetter.getNullURI().toString();
            }
            // should be used as the RP source array for volume create.
            if (param.getHighAvailability().getHaVirtualArrayVirtualPool().getActiveProtectionAtHASite() != null && param.getHighAvailability().getHaVirtualArrayVirtualPool().getActiveProtectionAtHASite()) {
                vpool.setHaVarrayConnectedToRp(haVarrayId);
            }
            StringMap haVarrayVirtualPoolMap = new StringMap();
            haVarrayVirtualPoolMap.put(haVarrayId, haVarrayVpoolId);
            vpool.setHaVarrayVpoolMap(haVarrayVirtualPoolMap);
        } else {
            final VirtualArrayVirtualPoolMapEntry haVirtualArrayVirtualPool = param.getHighAvailability().getHaVirtualArrayVirtualPool();
            if ((haVirtualArrayVirtualPool != null) && ((haVirtualArrayVirtualPool.getVirtualArray() != null) || (haVirtualArrayVirtualPool.getVirtualPool() != null))) {
                throw APIException.badRequests.invalidParameterVirtualPoolAndVirtualArrayNotApplicableForHighAvailabilityType(param.getHighAvailability().getType());
            }
        }
    }
    // Set expandable
    if (param.getExpandable() != null) {
        vpool.setExpandable(param.getExpandable());
    }
    if (param.getFastExpansion() != null) {
        vpool.setFastExpansion(param.getFastExpansion());
    }
    if (null != param.getAutoTieringPolicyName() && !param.getAutoTieringPolicyName().isEmpty()) {
        vpool.setAutoTierPolicyName(param.getAutoTieringPolicyName());
    }
    if (param.getCompressionEnabled() != null) {
        vpool.setCompressionEnabled(param.getCompressionEnabled());
    }
    if (null != param.getDriveType()) {
        vpool.setDriveType(param.getDriveType());
    } else {
        vpool.setDriveType(NONE);
    }
    // Set the min/max paths an paths per initiator
    validateAndSetPathParams(vpool, param.getMaxPaths(), param.getMinPaths(), param.getPathsPerInitiator());
    if (null != param.getUniquePolicyNames()) {
        vpool.setUniquePolicyNames(param.getUniquePolicyNames());
    }
    // set limit for host bandwidth
    if (param.getHostIOLimitBandwidth() != null) {
        vpool.setHostIOLimitBandwidth(param.getHostIOLimitBandwidth());
    }
    // set limit for host i/o
    if (param.getHostIOLimitIOPs() != null) {
        vpool.setHostIOLimitIOPs(param.getHostIOLimitIOPs());
    }
    // set placement policy
    if (param.getPlacementPolicy() != null) {
        vpool.setPlacementPolicy(param.getPlacementPolicy());
    }
    // set dedup capable or not
    if (null != param.getDedupCapable()) {
        vpool.setDedupCapable(param.getDedupCapable());
    }
    return vpool;
}
Also used : StringSetMap(com.emc.storageos.db.client.model.StringSetMap) VpoolRemoteCopyProtectionSettings(com.emc.storageos.db.client.model.VpoolRemoteCopyProtectionSettings) StringMap(com.emc.storageos.db.client.model.StringMap) VirtualPoolRemoteProtectionVirtualArraySettingsParam(com.emc.storageos.model.vpool.VirtualPoolRemoteProtectionVirtualArraySettingsParam) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) NamedURI(com.emc.storageos.db.client.model.NamedURI) VpoolProtectionVarraySettings(com.emc.storageos.db.client.model.VpoolProtectionVarraySettings) VirtualPoolMapper.toBlockVirtualPool(com.emc.storageos.api.mapper.VirtualPoolMapper.toBlockVirtualPool) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) VirtualPoolProtectionVirtualArraySettingsParam(com.emc.storageos.model.vpool.VirtualPoolProtectionVirtualArraySettingsParam) StringSet(com.emc.storageos.db.client.model.StringSet) ProtectionSourcePolicy(com.emc.storageos.model.vpool.ProtectionSourcePolicy) VirtualArrayVirtualPoolMapEntry(com.emc.storageos.model.vpool.VirtualPoolHighAvailabilityParam.VirtualArrayVirtualPoolMapEntry)

Example 12 with VirtualPoolRemoteProtectionVirtualArraySettingsParam

use of com.emc.storageos.model.vpool.VirtualPoolRemoteProtectionVirtualArraySettingsParam 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

VirtualPoolRemoteProtectionVirtualArraySettingsParam (com.emc.storageos.model.vpool.VirtualPoolRemoteProtectionVirtualArraySettingsParam)12 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)5 URI (java.net.URI)5 VirtualPoolProtectionVirtualArraySettingsParam (com.emc.storageos.model.vpool.VirtualPoolProtectionVirtualArraySettingsParam)4 StringMap (com.emc.storageos.db.client.model.StringMap)3 VpoolRemoteCopyProtectionSettings (com.emc.storageos.db.client.model.VpoolRemoteCopyProtectionSettings)3 ProtectionSourcePolicy (com.emc.storageos.model.vpool.ProtectionSourcePolicy)3 StringSet (com.emc.storageos.db.client.model.StringSet)2 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)2 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)2 VpoolProtectionVarraySettings (com.emc.storageos.db.client.model.VpoolProtectionVarraySettings)2 BlockVirtualPoolProtectionParam (com.emc.storageos.model.vpool.BlockVirtualPoolProtectionParam)2 VirtualPoolHighAvailabilityParam (com.emc.storageos.model.vpool.VirtualPoolHighAvailabilityParam)2 VirtualPoolProtectionRPParam (com.emc.storageos.model.vpool.VirtualPoolProtectionRPParam)2 VirtualPoolRemoteMirrorProtectionParam (com.emc.storageos.model.vpool.VirtualPoolRemoteMirrorProtectionParam)2 ArrayList (java.util.ArrayList)2 VirtualPoolMapper.toBlockVirtualPool (com.emc.storageos.api.mapper.VirtualPoolMapper.toBlockVirtualPool)1 NamedURI (com.emc.storageos.db.client.model.NamedURI)1 BlockVirtualPoolRestRep (com.emc.storageos.model.vpool.BlockVirtualPoolRestRep)1 ProtectionCopyPolicy (com.emc.storageos.model.vpool.ProtectionCopyPolicy)1