Search in sources :

Example 6 with BlockVirtualPoolForm

use of models.virtualpool.BlockVirtualPoolForm in project coprhd-controller by CoprHD.

the class BlockVirtualPools method createBaseVPool.

private static void createBaseVPool(String vpoolName, String storageType, List<String> virtualarrayIds, String vpdesc, JsonArray vpools) {
    BlockVirtualPoolForm vpool = new BlockVirtualPoolForm();
    // defaults
    vpool.provisioningType = ProvisioningTypes.THIN;
    vpool.protocols = Sets.newHashSet(BlockProtocols.FC);
    vpool.minPaths = 1;
    vpool.maxPaths = 1;
    vpool.initiatorPaths = 1;
    vpool.expandable = true;
    vpool.rpJournalSizeUnit = SizeUnit.x;
    vpool.rpJournalSize = RPCopyForm.JOURNAL_DEFAULT_MULTIPLIER;
    vpool.rpRpoValue = Long.valueOf(25);
    vpool.rpRpoType = RpoType.SECONDS;
    vpool.protectSourceSite = true;
    vpool.enableAutoCrossConnExport = true;
    vpool.poolAssignment = PoolAssignmentTypes.AUTOMATIC;
    vpool.maxSnapshots = 10;
    vpool.name = vpoolName;
    vpool.systemType = storageType;
    vpool.virtualArrays = virtualarrayIds;
    vpool.description = vpdesc;
    vpool.enableCompression = false;
    // Check if creating a vmax AFA virtual pool, need to set auto-tiering
    if (StringUtils.equals(VMAX, storageType)) {
        vpool.uniqueAutoTierPolicyNames = true;
        boolean isAutoTier = false;
        AutoTierPolicyNamesCall auto_tiering = vpool.autoTierPolicyNames();
        List<String> autoPolicyList = auto_tiering.call();
        for (String policy : autoPolicyList) {
            if (StringUtils.equals(DEFAULT_AUTO_TIER, policy)) {
                vpool.autoTierPolicy = policy;
                isAutoTier = true;
                break;
            }
        }
        if (!isAutoTier) {
            // This means we did not find the pattern, set random
            for (String policy : autoPolicyList) {
                vpool.autoTierPolicy = policy;
                break;
            }
        }
        for (String virtualArrayId : virtualarrayIds) {
            List<StoragePoolRestRep> spList = StoragePoolUtils.getStoragePoolsAssignedToVirtualArray(virtualArrayId);
            for (StoragePoolRestRep sp : spList) {
                if (sp.getCompressionEnabled() != null && sp.getCompressionEnabled()) {
                    vpool.enableCompression = true;
                    // rename with compression enable
                    vpool.name = VP_VMAX_DIAMOND_COMPRESSED;
                    break;
                }
            }
            if (vpool.enableCompression) {
                break;
            }
        }
    }
    BlockVirtualPoolRestRep vpoolTask = vpool.save();
    if (vpoolTask != null) {
        buildVpoolCookies(vpoolTask.getId().toString(), vpool.name, vpools);
    }
}
Also used : AutoTierPolicyNamesCall(jobs.vipr.AutoTierPolicyNamesCall) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep) BlockVirtualPoolForm(models.virtualpool.BlockVirtualPoolForm)

Aggregations

BlockVirtualPoolForm (models.virtualpool.BlockVirtualPoolForm)6 BlockVirtualPoolRestRep (com.emc.storageos.model.vpool.BlockVirtualPoolRestRep)4 StoragePoolRestRep (com.emc.storageos.model.pools.StoragePoolRestRep)2 URI (java.net.URI)1 AutoTierPolicyNamesCall (jobs.vipr.AutoTierPolicyNamesCall)1 StoragePoolInfo (models.datatable.StoragePoolDataTable.StoragePoolInfo)1