Search in sources :

Example 1 with FileVirtualPoolProtectionParam

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

the class VirtualPoolMapper method toFileVirtualPool.

public static FileVirtualPoolRestRep toFileVirtualPool(VirtualPool from) {
    if (from == null) {
        return null;
    }
    FileVirtualPoolRestRep to = new FileVirtualPoolRestRep();
    // Show the feature even if it's disabled
    to.setProtection(new FileVirtualPoolProtectionParam());
    to.getProtection().setSnapshots(new VirtualPoolProtectionSnapshotsParam());
    to.getProtection().getSnapshots().setMaxSnapshots(from.getMaxNativeSnapshots());
    to.getProtection().setReplicationSupported(from.getFileReplicationSupported());
    to.getProtection().setAllowFilePolicyAtProjectLevel(from.getAllowFilePolicyAtProjectLevel());
    to.getProtection().setAllowFilePolicyAtFSLevel(from.getAllowFilePolicyAtFSLevel());
    if (from.getFrRpoType() != null) {
        to.getProtection().setMinRpoType(from.getFrRpoType());
    }
    if (from.getFrRpoValue() != null) {
        to.getProtection().setMinRpoValue(from.getFrRpoValue());
    }
    to.getProtection().setScheduleSnapshots(from.getScheduleSnapshots());
    to.setLongTermRetention(from.getLongTermRetention());
    if (from.getFilePolicies() != null && !from.getFilePolicies().isEmpty()) {
        to.setFileProtectionPolicies(from.getFilePolicies());
    }
    return mapVirtualPoolFields(from, to, null);
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) VirtualPoolProtectionSnapshotsParam(com.emc.storageos.model.vpool.VirtualPoolProtectionSnapshotsParam) FileVirtualPoolProtectionParam(com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam)

Example 2 with FileVirtualPoolProtectionParam

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

the class FileProtectionPolicies method getFileVirtualPoolsOptions.

private static List<StringOption> getFileVirtualPoolsOptions(FilePolicyRestRep policy) {
    Collection<FileVirtualPoolRestRep> virtualPools;
    virtualPools = getViprClient().fileVpools().getAll();
    Collection<FileVirtualPoolRestRep> vPools = Lists.newArrayList();
    for (FileVirtualPoolRestRep vpool : virtualPools) {
        // first level filter based on the protection is enabled or not
        FileVirtualPoolProtectionParam protectParam = vpool.getProtection();
        if (protectParam == null) {
            continue;
        }
        // 2nde level filter based on the applied level of policy and the pool
        if (FilePolicyApplyLevel.project.name().equalsIgnoreCase(policy.getAppliedAt()) && !protectParam.getAllowFilePolicyAtProjectLevel()) {
            continue;
        }
        if (FilePolicyApplyLevel.file_system.name().equalsIgnoreCase(policy.getAppliedAt()) && !protectParam.getAllowFilePolicyAtFSLevel()) {
            continue;
        }
        // now add pool into list if matches protection type with policy
        if (FilePolicyType.file_snapshot.name().equalsIgnoreCase(policy.getType()) && protectParam.getScheduleSnapshots()) {
            vPools.add(vpool);
        } else if (FilePolicyType.file_replication.name().equalsIgnoreCase(policy.getType()) && protectParam.getReplicationSupported()) {
            vPools.add(vpool);
        }
    }
    return createResourceOptions(vPools);
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) FileVirtualPoolProtectionParam(com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam)

Example 3 with FileVirtualPoolProtectionParam

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

the class FileVirtualPoolForm method doLoad.

protected void doLoad(FileVirtualPoolRestRep virtualPool) {
    loadCommon(virtualPool);
    FileVirtualPoolProtectionParam protection = virtualPool.getProtection();
    if ((protection != null) && (protection.getSnapshots() != null)) {
        maxSnapshots = protection.getSnapshots().getMaxSnapshots();
    }
    if (protection != null) {
        scheduleSnapshots = protection.getScheduleSnapshots();
        replicationSupported = protection.getReplicationSupported();
        allowPolicyApplyAtProject = protection.getAllowFilePolicyAtProjectLevel();
        allowPolicyApplyAtFS = protection.getAllowFilePolicyAtFSLevel();
        rpRpoType = protection.getMinRpoType();
        replicationRpo = protection.getMinRpoValue();
    }
    longTermRetention = virtualPool.getLongTermRetention();
}
Also used : FileVirtualPoolProtectionParam(com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam)

Example 4 with FileVirtualPoolProtectionParam

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

the class FileVirtualPoolService method prepareVirtualPool.

// this method must not persist anything to the DB.
private VirtualPool prepareVirtualPool(FileVirtualPoolParam param, boolean validateReplArgs) {
    VirtualPool vPool = new VirtualPool();
    vPool.setType(VirtualPool.Type.file.name());
    // set common VirtualPool parameters.
    populateCommonVirtualPoolCreateParams(vPool, param);
    StringSetMap arrayInfo = new StringSetMap();
    if (null != param.getSystemType()) {
        if (!VirtualPool.SystemType.NONE.toString().equals(param.getSystemType()) && !VirtualPool.SystemType.isFileTypeSystem(param.getSystemType())) {
            throw APIException.badRequests.invalidParameter("system_type", param.getSystemType());
        }
        arrayInfo.put(VirtualPoolCapabilityValuesWrapper.SYSTEM_TYPE, param.getSystemType());
        vPool.addArrayInfoDetails(arrayInfo);
    }
    vPool.setMaxNativeSnapshots(VirtualPool.MAX_DISABLED);
    if (null != param.getProtection()) {
        FileVirtualPoolProtectionParam protectionParam = param.getProtection();
        if ((protectionParam.getSnapshots() != null) && (protectionParam.getSnapshots().getMaxSnapshots() != null)) {
            vPool.setMaxNativeSnapshots(protectionParam.getSnapshots().getMaxSnapshots());
        }
        vPool.setScheduleSnapshots(false);
        if (protectionParam.getScheduleSnapshots() != null) {
            vPool.setScheduleSnapshots(protectionParam.getScheduleSnapshots());
        }
        vPool.setFileReplicationSupported(false);
        if (protectionParam.getReplicationSupported() != null) {
            vPool.setFileReplicationSupported(protectionParam.getReplicationSupported());
        }
        vPool.setAllowFilePolicyAtProjectLevel(false);
        if (protectionParam.getAllowFilePolicyAtProjectLevel() != null) {
            vPool.setAllowFilePolicyAtProjectLevel(protectionParam.getAllowFilePolicyAtProjectLevel());
        }
        vPool.setAllowFilePolicyAtFSLevel(false);
        if (protectionParam.getAllowFilePolicyAtFSLevel() != null) {
            vPool.setAllowFilePolicyAtFSLevel(protectionParam.getAllowFilePolicyAtFSLevel());
        }
    }
    if (null != param.getLongTermRetention()) {
        vPool.setLongTermRetention(param.getLongTermRetention());
    }
    return vPool;
}
Also used : StringSetMap(com.emc.storageos.db.client.model.StringSetMap) FileVirtualPoolProtectionParam(com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam) VirtualPoolMapper.toFileVirtualPool(com.emc.storageos.api.mapper.VirtualPoolMapper.toFileVirtualPool) MapFileVirtualPool(com.emc.storageos.api.mapper.functions.MapFileVirtualPool) VirtualPool(com.emc.storageos.db.client.model.VirtualPool)

Example 5 with FileVirtualPoolProtectionParam

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

the class FileProtectionPolicies method getVpoolForProtectionPolicy.

/**
 * This call return the pool or pools which can be associated with policy.
 * Currently this does not check vpool is assigned to another policy.
 * As we do not have direct reference of policy in file vpool and looping all
 * policy and then its assigned resource to figure out it is assign or not
 * is causing slowness in GUI.Will address this in future release
 *
 * @param id
 */
public static void getVpoolForProtectionPolicy(String id) {
    Collection<FileVirtualPoolRestRep> vPools = Lists.newArrayList();
    FilePolicyRestRep policy = getViprClient().fileProtectionPolicies().get(uri(id));
    if (policy.getAssignedResources() != null && !policy.getAssignedResources().isEmpty()) {
        NamedRelatedResourceRep vpoolNameRes = null;
        // get the first vpool and return it.
        if (policy.getAppliedAt().equalsIgnoreCase(FilePolicyApplyLevel.vpool.name())) {
            vpoolNameRes = policy.getAssignedResources().get(0);
        } else if (policy.getAppliedAt().equalsIgnoreCase(FilePolicyApplyLevel.project.name())) {
            vpoolNameRes = policy.getVpool();
        }
        if (vpoolNameRes != null) {
            FileVirtualPoolRestRep vpolRestep = getViprClient().fileVpools().get(vpoolNameRes.getId());
            vPools.add(vpolRestep);
            renderJSON(vPools);
            return;
        }
    }
    List<FileVirtualPoolRestRep> virtualPools = getViprClient().fileVpools().getAll();
    for (FileVirtualPoolRestRep vpool : virtualPools) {
        // first level filter based on the protection is enabled or not
        FileVirtualPoolProtectionParam protectParam = vpool.getProtection();
        if (protectParam == null) {
            continue;
        }
        // 2nde level filter based on the applied level of policy and the pool
        if (FilePolicyApplyLevel.project.name().equalsIgnoreCase(policy.getAppliedAt()) && !protectParam.getAllowFilePolicyAtProjectLevel()) {
            continue;
        }
        if (FilePolicyApplyLevel.file_system.name().equalsIgnoreCase(policy.getAppliedAt()) && !protectParam.getAllowFilePolicyAtFSLevel()) {
            continue;
        }
        // now add pool into list if matches protection type with policy
        if (FilePolicyType.file_snapshot.name().equalsIgnoreCase(policy.getType()) && protectParam.getScheduleSnapshots()) {
            vPools.add(vpool);
        } else if (FilePolicyType.file_replication.name().equalsIgnoreCase(policy.getType()) && protectParam.getReplicationSupported()) {
            vPools.add(vpool);
        }
    }
    renderJSON(vPools);
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) FileVirtualPoolProtectionParam(com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam) FilePolicyRestRep(com.emc.storageos.model.file.policy.FilePolicyRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Aggregations

FileVirtualPoolProtectionParam (com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam)5 FileVirtualPoolRestRep (com.emc.storageos.model.vpool.FileVirtualPoolRestRep)3 VirtualPoolMapper.toFileVirtualPool (com.emc.storageos.api.mapper.VirtualPoolMapper.toFileVirtualPool)1 MapFileVirtualPool (com.emc.storageos.api.mapper.functions.MapFileVirtualPool)1 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)1 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)1 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)1 VirtualPoolProtectionSnapshotsParam (com.emc.storageos.model.vpool.VirtualPoolProtectionSnapshotsParam)1