Search in sources :

Example 1 with VirtualPoolProtectionRPChanges

use of com.emc.storageos.model.vpool.VirtualPoolProtectionRPChanges 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 BlockVirtualPoolProtectionUpdateParam
 * @param vPool Virtual Pool (null for creating new virtual pool, or validating current value is not necessary)
 */
private void validateProtection(BlockVirtualPoolProtectionUpdateParam protectionParam, VirtualPool vPool) {
    if (protectionParam != null) {
        VirtualPoolProtectionRPChanges rpChanges = protectionParam.getRecoverPoint();
        if (rpChanges != null) {
            if ((rpChanges.getAdd() != null && !rpChanges.getAdd().isEmpty()) || (rpChanges.getRemove() != null && !rpChanges.getRemove().isEmpty()) || rpChanges.getSourcePolicy() != null) {
                throw APIException.badRequests.arrayAffinityPlacementPolicyNotAllowedForRPOrRemoteCopies();
            }
        }
        VirtualPoolRemoteProtectionUpdateParam remoteCopies = protectionParam.getRemoteCopies();
        if (remoteCopies != null) {
            if ((remoteCopies.getAdd() != null && !remoteCopies.getAdd().isEmpty()) || (remoteCopies.getRemove() != null && !remoteCopies.getRemove().isEmpty())) {
                throw APIException.badRequests.arrayAffinityPlacementPolicyNotAllowedForRPOrRemoteCopies();
            }
        }
    } else if (vPool != null) {
        if (VirtualPool.vPoolSpecifiesProtection(vPool) || VirtualPool.vPoolSpecifiesSRDF(vPool)) {
            throw APIException.badRequests.arrayAffinityPlacementPolicyNotAllowedForRPOrRemoteCopies();
        }
    }
}
Also used : VirtualPoolProtectionRPChanges(com.emc.storageos.model.vpool.VirtualPoolProtectionRPChanges) VirtualPoolRemoteProtectionUpdateParam(com.emc.storageos.model.vpool.VirtualPoolRemoteProtectionUpdateParam)

Example 2 with VirtualPoolProtectionRPChanges

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

the class ProtectionValidator method validateJournalSizes.

/**
 * Validation of journal sizes and other protection parameters, if they exist.
 *
 * @param virtualPool
 * @param updateParam
 * @param dbClient
 */
private void validateJournalSizes(VirtualPool virtualPool, BlockVirtualPoolUpdateParam updateParam, DbClient dbClient) {
    Map<String, Object> protection = getProtectionUpdateParameters(updateParam);
    Map<String, Object> enabledProtections = filterEntries(protection, and(paramEntryValueNotNull(), paramEntryValueNotNone()));
    _logger.info("Requested VirtualPool protections: {}", enabledProtections);
    if (enabledProtections.get(PROTECTION_RP) != null) {
        VirtualPoolProtectionRPChanges rp = (VirtualPoolProtectionRPChanges) enabledProtections.get(PROTECTION_RP);
        if (rp != null) {
            // must be specified in the update request.
            if (VirtualPool.vPoolSpecifiesProtection(virtualPool) || (rp.getAdd() != null && !rp.getAdd().isEmpty())) {
                validateSourcePolicy(rp.getSourcePolicy());
                if (rp.getAdd() != null) {
                    validateProtectionCopies(rp.getAdd(), dbClient);
                }
            } else if (rp.getSourcePolicy() != null && rp.getSourcePolicy().getJournalSize() != null) {
                throwServicePolicyNoProtectionException();
            }
        }
    }
}
Also used : VirtualPoolProtectionRPChanges(com.emc.storageos.model.vpool.VirtualPoolProtectionRPChanges)

Example 3 with VirtualPoolProtectionRPChanges

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

the class BlockVirtualPoolUpdateBuilder method disableRecoverPoint.

public BlockVirtualPoolUpdateBuilder disableRecoverPoint() {
    getProtection().setRecoverPoint(new VirtualPoolProtectionRPChanges());
    Set<VirtualPoolProtectionVirtualArraySettingsParam> noCopies = Sets.newHashSet();
    setRecoverPointCopies(noCopies);
    return this;
}
Also used : VirtualPoolProtectionRPChanges(com.emc.storageos.model.vpool.VirtualPoolProtectionRPChanges) VirtualPoolProtectionVirtualArraySettingsParam(com.emc.storageos.model.vpool.VirtualPoolProtectionVirtualArraySettingsParam)

Example 4 with VirtualPoolProtectionRPChanges

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

the class ProtectionValidator method validateRpNonHaCopyVpools.

private void validateRpNonHaCopyVpools(BlockVirtualPoolUpdateParam updateParam, DbClient dbClient) {
    if (updateParam.getProtection() != null && updateParam.getProtection().specifiesRPProtection() && !updateParam.specifiesHighAvailability()) {
        // validate the copy target vpools
        BlockVirtualPoolProtectionUpdateParam protection = updateParam.getProtection();
        VirtualPoolProtectionRPChanges rpParam = protection.getRecoverPoint();
        if (rpParam != null) {
            for (VirtualPoolProtectionVirtualArraySettingsParam protectionSettings : rpParam.getAdd()) {
                if (protectionSettings.getVpool() != null) {
                    VirtualPool protectionVirtualPool = dbClient.queryObject(VirtualPool.class, protectionSettings.getVpool());
                    if (VirtualPool.vPoolSpecifiesHighAvailability(protectionVirtualPool)) {
                        // does not specify HA.
                        throw APIException.badRequests.nonVirtualToVirtualProtectionNotSupported();
                    }
                }
            }
        }
    }
}
Also used : VirtualPoolProtectionRPChanges(com.emc.storageos.model.vpool.VirtualPoolProtectionRPChanges) BlockVirtualPoolProtectionUpdateParam(com.emc.storageos.model.vpool.BlockVirtualPoolProtectionUpdateParam) VirtualPoolProtectionVirtualArraySettingsParam(com.emc.storageos.model.vpool.VirtualPoolProtectionVirtualArraySettingsParam) VirtualPool(com.emc.storageos.db.client.model.VirtualPool)

Aggregations

VirtualPoolProtectionRPChanges (com.emc.storageos.model.vpool.VirtualPoolProtectionRPChanges)4 VirtualPoolProtectionVirtualArraySettingsParam (com.emc.storageos.model.vpool.VirtualPoolProtectionVirtualArraySettingsParam)2 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)1 BlockVirtualPoolProtectionUpdateParam (com.emc.storageos.model.vpool.BlockVirtualPoolProtectionUpdateParam)1 VirtualPoolRemoteProtectionUpdateParam (com.emc.storageos.model.vpool.VirtualPoolRemoteProtectionUpdateParam)1