Search in sources :

Example 1 with VirtualPoolProtectionVirtualArraySettingsParam

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

the class ProtectionValidator method validateProtectionCopies.

/**
 * Validates the RP protection copies. The protection copy consists of
 * a virtual array, virtual pool, and copy policy - each of which are
 * validated if they are specified.
 *
 * @param copies The protection copies
 * @param dbClient The dbclient
 */
private void validateProtectionCopies(Set<VirtualPoolProtectionVirtualArraySettingsParam> copies, DbClient dbClient) {
    if (copies != null) {
        for (VirtualPoolProtectionVirtualArraySettingsParam settingsParam : copies) {
            // a protection copy.
            if (settingsParam.getVarray() != null && !settingsParam.getVarray().toString().isEmpty()) {
                ArgValidator.checkUri(settingsParam.getVarray());
                VirtualArray neighborhood = dbClient.queryObject(VirtualArray.class, settingsParam.getVarray());
                ArgValidator.checkEntity(neighborhood, settingsParam.getVarray(), false);
            } else {
                throw APIException.badRequests.protectionVirtualPoolArrayMissing();
            }
            // Validate the protection copy virtual pool if it has been specified.
            if (settingsParam.getVpool() != null && !String.valueOf(settingsParam.getVpool()).isEmpty()) {
                ArgValidator.checkUri(settingsParam.getVpool());
                VirtualPool protectionCopyVPool = dbClient.queryObject(VirtualPool.class, settingsParam.getVpool());
                ArgValidator.checkEntity(protectionCopyVPool, settingsParam.getVpool(), false);
            }
            // Validate the copy policy
            if (settingsParam.getCopyPolicy() != null && settingsParam.getCopyPolicy().getJournalSize() != null) {
                if (!isParsableToDouble(settingsParam.getCopyPolicy().getJournalSize()) && !settingsParam.getCopyPolicy().getJournalSize().matches(JOURNAL_REGEX_1) && !settingsParam.getCopyPolicy().getJournalSize().matches(JOURNAL_REGEX_2) && !settingsParam.getCopyPolicy().getJournalSize().equals(JOURNAL_MIN)) {
                    throw APIException.badRequests.protectionVirtualPoolJournalSizeInvalid("copy", settingsParam.getCopyPolicy().getJournalSize());
                }
            }
        }
    }
}
Also used : VirtualArray(com.emc.storageos.db.client.model.VirtualArray) VirtualPoolProtectionVirtualArraySettingsParam(com.emc.storageos.model.vpool.VirtualPoolProtectionVirtualArraySettingsParam) VirtualPool(com.emc.storageos.db.client.model.VirtualPool)

Example 2 with VirtualPoolProtectionVirtualArraySettingsParam

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

the class BlockVirtualPoolUpdateBuilder method createRecoverPointCopy.

public VirtualPoolProtectionVirtualArraySettingsParam createRecoverPointCopy(URI virtualArrayId, URI virtualPoolId, String journalSize) {
    VirtualPoolProtectionVirtualArraySettingsParam param = new VirtualPoolProtectionVirtualArraySettingsParam();
    param.setCopyPolicy(new ProtectionCopyPolicy(journalSize));
    param.setVarray(virtualArrayId);
    param.setVpool(virtualPoolId);
    return param;
}
Also used : VirtualPoolProtectionVirtualArraySettingsParam(com.emc.storageos.model.vpool.VirtualPoolProtectionVirtualArraySettingsParam) ProtectionCopyPolicy(com.emc.storageos.model.vpool.ProtectionCopyPolicy)

Example 3 with VirtualPoolProtectionVirtualArraySettingsParam

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

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

the class BlockVirtualPoolForm method apply.

private BlockVirtualPoolBuilder apply(BlockVirtualPoolBuilder builder) {
    applyCommon(builder);
    builder.setMinPaths(defaultInt(minPaths, 1));
    builder.setMaxPaths(defaultInt(maxPaths, 1));
    builder.setPathsPerInitiator(defaultInt(initiatorPaths, 1));
    builder.setDriveType(driveType);
    builder.setAutoTieringPolicyName(autoTierPolicy);
    builder.setCompressionEnabled(defaultBoolean(enableCompression));
    builder.setExpandable(defaultBoolean(expandable));
    builder.setFastExpansion(defaultBoolean(fastExpansion));
    builder.setMultiVolumeConsistency(defaultBoolean(multiVolumeConsistency));
    builder.setSnapshots(maxSnapshots);
    builder.setContinuousCopies(maxContinuousCopies, uri(continuousCopyVirtualPool));
    builder.setThinVolumePreAllocationPercentage(thinPreAllocationPercent);
    builder.setUniquePolicyNames(defaultBoolean(uniqueAutoTierPolicyNames));
    builder.setRaidLevels(raidLevels);
    builder.setHostIOLimitBandwidth(defaultInt(hostIOLimitBandwidth, 0));
    builder.setHostIOLimitIOPs(defaultInt(hostIOLimitIOPs, 0));
    builder.setDedupCapable(defaultBoolean(enableDeDup));
    builder.setPlacementPolicy(placementPolicy);
    if (ProtectionSystemTypes.isRecoverPoint(remoteProtection)) {
        builder.enableRecoverPoint(RPCopyForm.formatJournalSize(rpJournalSize, rpJournalSizeUnit));
        builder.setRecoverPointRemoteCopyMode(rpRemoteCopyMode);
        builder.setRecoverPointRpo(rpRpoValue, rpRpoType);
        Set<VirtualPoolProtectionVirtualArraySettingsParam> copies = Sets.newLinkedHashSet();
        for (RPCopyForm rpCopy : rpCopies) {
            if (rpCopy != null && rpCopy.isEnabled()) {
                copies.add(rpCopy.write());
            }
        }
        builder.setRecoverPointCopies(copies);
        // Set journal varray and vpool default for source
        builder.setJournalVarrayAndVpool(uri(sourceJournalVArray), uri(sourceJournalVPool));
    }
    if (ProtectionSystemTypes.isSRDF(remoteProtection)) {
        if (srdfCopies != null) {
            List<VirtualPoolRemoteProtectionVirtualArraySettingsParam> copies = Lists.newArrayList();
            for (SrdfCopyForm srdfCopyForm : srdfCopies) {
                if (srdfCopyForm != null && srdfCopyForm.isEnabled()) {
                    copies.add(srdfCopyForm.write(srdfCopyMode));
                }
            }
            builder.setRemoteCopies(copies);
        }
    }
    if (HighAvailability.isHighAvailability(highAvailability)) {
        URI virtualArrayId = uri(haVirtualArray);
        URI virtualPoolId = uri(haVirtualPool);
        boolean activeProtectionAtHASite = BooleanUtils.isTrue(protectHASite);
        boolean metroPoint = false;
        if (BooleanUtils.isTrue(protectSourceSite) && BooleanUtils.isTrue(protectHASite)) {
            metroPoint = true;
            activeProtectionAtHASite = StringUtils.equalsIgnoreCase(activeSite, HighAvailability.VPLEX_HA);
            builder.setJournalVarrayAndVpool(uri(sourceJournalVArray), uri(sourceJournalVPool));
            builder.setStandByJournalVArrayVpool(uri(haJournalVArray), uri(haJournalVPool));
        } else {
            if (activeProtectionAtHASite) {
                builder.setJournalVarrayAndVpool(uri(haJournalVArray), uri(haJournalVPool));
            } else {
                builder.setJournalVarrayAndVpool(uri(sourceJournalVArray), uri(sourceJournalVPool));
            }
            // Reset the standby varray/vpool values
            builder.setStandByJournalVArrayVpool(null, null);
        }
        builder.setHighAvailability(highAvailability, enableAutoCrossConnExport, virtualArrayId, virtualPoolId, activeProtectionAtHASite, metroPoint);
    }
    return builder;
}
Also used : VirtualPoolRemoteProtectionVirtualArraySettingsParam(com.emc.storageos.model.vpool.VirtualPoolRemoteProtectionVirtualArraySettingsParam) VirtualPoolProtectionVirtualArraySettingsParam(com.emc.storageos.model.vpool.VirtualPoolProtectionVirtualArraySettingsParam) URI(java.net.URI)

Example 5 with VirtualPoolProtectionVirtualArraySettingsParam

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

the class RPCopyForm method write.

public VirtualPoolProtectionVirtualArraySettingsParam write() {
    VirtualPoolProtectionVirtualArraySettingsParam param = new VirtualPoolProtectionVirtualArraySettingsParam();
    param.setCopyPolicy(new ProtectionCopyPolicy(getFormattedJournalSize()));
    param.setCopyPolicy(new ProtectionCopyPolicy(getFormattedJournalSize(), uri(journalVArray), uri(journalVPool)));
    param.setVarray(uri(virtualArray));
    param.setVpool(uri(virtualPool));
    return param;
}
Also used : VirtualPoolProtectionVirtualArraySettingsParam(com.emc.storageos.model.vpool.VirtualPoolProtectionVirtualArraySettingsParam) ProtectionCopyPolicy(com.emc.storageos.model.vpool.ProtectionCopyPolicy)

Aggregations

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