Search in sources :

Example 31 with AutoTieringPolicy

use of com.emc.storageos.db.client.model.AutoTieringPolicy in project coprhd-controller by CoprHD.

the class SmisCommandHelper method getPolicyByBlockObject.

/**
 * Get the policy by BlockObject autoTieringPolicy URI.
 *
 * @param pool
 * @param autoTierPolicyName
 * @param policyURI
 * @param compressionEnabled - If the compression is enabled at the Virtual pool level, we must honor it.
 * @return
 */
private StringBuffer getPolicyByBlockObject(URI pool, String autoTierPolicyName, URI policyURI, Boolean compressionEnabled) {
    StoragePool storagePool = _dbClient.queryObject(StoragePool.class, pool);
    StringBuffer policyName = new StringBuffer();
    if ((null != autoTierPolicyName && Constants.NONE.equalsIgnoreCase(autoTierPolicyName)) || (NullColumnValueGetter.isNullURI(policyURI))) {
        if (compressionEnabled) {
            // If compression is enabled at the Virtual pool level, the Storage Group has to be fast managed when the SLO is none
            policyName = policyName.append(Constants.NONE.toUpperCase()).append(Constants._plusDelimiter).append(Constants.NONE.toUpperCase()).append(Constants._plusDelimiter).append(storagePool.getPoolName());
        } else {
            policyName = policyName.append(Constants.NONE);
        }
    } else {
        AutoTieringPolicy autoTierPolicy = _dbClient.queryObject(AutoTieringPolicy.class, policyURI);
        policyName = policyName.append(autoTierPolicy.getVmaxSLO()).append(Constants._plusDelimiter).append(autoTierPolicy.getVmaxWorkload().toUpperCase()).append(Constants._plusDelimiter).append(storagePool.getPoolName());
    }
    return policyName;
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) StoragePool(com.emc.storageos.db.client.model.StoragePool)

Example 32 with AutoTieringPolicy

use of com.emc.storageos.db.client.model.AutoTieringPolicy in project coprhd-controller by CoprHD.

the class SmisCommandHelper method getVolumeGroupPath.

/*
     * find/create storage group for VMAX V3
     */
public CIMObjectPath getVolumeGroupPath(StorageSystem forProvider, StorageSystem storageSystem, Volume volume, StoragePool storagePool) {
    CIMObjectPath volumeGrouptPath = null;
    URI policyURI = volume.getAutoTieringPolicyUri();
    // Don't create Parking SLO SG if there is no Fast policy associated
    if (storageSystem.checkIfVmax3() && !NullColumnValueGetter.isNullURI(policyURI)) {
        if (storagePool == null) {
            storagePool = _dbClient.queryObject(StoragePool.class, volume.getPool());
        }
        AutoTieringPolicy policy = _dbClient.queryObject(AutoTieringPolicy.class, policyURI);
        String slo = policy.getVmaxSLO();
        String workload = policy.getVmaxWorkload().toUpperCase();
        String srp = storagePool.getPoolName();
        // Try to find existing storage group.
        volumeGrouptPath = getVolumeGroupBasedOnSLO(forProvider, storageSystem, slo, workload, srp);
        if (volumeGrouptPath == null) {
            // Create new storage group.
            volumeGrouptPath = createVolumeGroupBasedOnSLO(forProvider, storageSystem, slo, workload, srp);
        }
    }
    return volumeGrouptPath;
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) StoragePool(com.emc.storageos.db.client.model.StoragePool) CIMObjectPath(javax.cim.CIMObjectPath) URI(java.net.URI)

Example 33 with AutoTieringPolicy

use of com.emc.storageos.db.client.model.AutoTieringPolicy in project coprhd-controller by CoprHD.

the class StoragePoolSettingProcessor method createOrUpdateSLOBasedAutoTierPolicy.

/**
 * Create or update an AutoTieringPolicy object with the passed parameters.
 *
 * Updates 'newSLOList' and 'updateSLOList'
 *
 * @param storageSystem [in] - StorageSystem that the AutoTierPolicy will belong to
 * @param policy [in] - If null, implies we have to create a new one, otherwise it's an update
 * @param sloID [in] - Native ID constructed based on the slo and workload
 * @param sloName [in] - SLO + Workload
 * @param avgResponseTime [in] - Average Expected Response time for the SLO + Workload @throws IOException
 */
private void createOrUpdateSLOBasedAutoTierPolicy(StorageSystem storageSystem, AutoTieringPolicy policy, String sloID, String sloName, String slo, String workload, String avgResponseTime) {
    boolean newPolicy = false;
    if (null == policy) {
        newPolicy = true;
        policy = new AutoTieringPolicy();
        policy.setId(URIUtil.createId(AutoTieringPolicy.class));
        policy.setStorageSystem(storageSystem.getId());
        policy.setNativeGuid(sloID);
        policy.setSystemType(storageSystem.getSystemType());
        policy.setVmaxSLO(slo);
        policy.setVmaxWorkload(workload);
    }
    policy.setLabel(sloName);
    policy.setPolicyName(sloName);
    policy.setPolicyEnabled(true);
    if (!Constants.NOT_AVAILABLE.equalsIgnoreCase(avgResponseTime)) {
        policy.setAvgExpectedResponseTime(Double.parseDouble(avgResponseTime));
    }
    // SLO is on V3 VMAX, which only supports Thin
    policy.setProvisioningType(AutoTieringPolicy.ProvisioningType.ThinlyProvisioned.name());
    if (newPolicy) {
        newSLOList.add(policy);
    } else {
        updateSLOList.add(policy);
    }
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy)

Example 34 with AutoTieringPolicy

use of com.emc.storageos.db.client.model.AutoTieringPolicy in project coprhd-controller by CoprHD.

the class FASTPolicyProcessor method performPolicyBookKeeping.

/**
 * if the policy had been deleted from the Array, the rediscovery cycle should set the fast Policy to inactive if that policy
 * has no volumes associated.
 *
 * @param policyNames
 * @param storageSystemURI
 * @throws IOException
 */
private void performPolicyBookKeeping(Set<String> policyNames, URI storageSystemURI) throws IOException {
    URIQueryResultList policyList = new URIQueryResultList();
    _dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceFASTPolicyConstraint(storageSystemURI), policyList);
    Iterator<AutoTieringPolicy> policyIterator = _dbClient.queryIterativeObjects(AutoTieringPolicy.class, policyList, true);
    while (policyIterator.hasNext()) {
        AutoTieringPolicy policyObject = policyIterator.next();
        String policyName = policyObject.getPolicyName();
        if (Constants.START_HIGH_THEN_AUTO_TIER_POLICY_NAME.equals(policyName) || // If a VMAX3 SLO AutoTierPolicy, do not process here
        !Strings.isNullOrEmpty(policyObject.getVmaxSLO())) {
            continue;
        }
        /**
         * Since START_HIGH_THEN_AUTO_TIER_POLICY is ViPR created policy, no need to clean up
         */
        if (!policyNames.contains(policyName) && !policyHasVolume(policyObject)) {
            policyObject.setPolicyEnabled(false);
            if (policyObject.getPools() != null) {
                policyObject.getPools().clear();
            } else {
                _logger.info("Policy {} does not have pools", policyObject.getId());
            }
            _logger.info("Marking Policy {}({}) inactive as it is not discovered", policyName, policyObject.getId());
            policyObject.setInactive(true);
            _dbClient.updateObject(policyObject);
        }
    }
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Example 35 with AutoTieringPolicy

use of com.emc.storageos.db.client.model.AutoTieringPolicy in project coprhd-controller by CoprHD.

the class RPBlockServiceApiImpl method logVolumeInfo.

/**
 * Helper method to display volume attributes as they are prepared.
 *
 * @param volume
 */
private String logVolumeInfo(Volume volume) {
    StringBuilder buf = new StringBuilder();
    if (null != volume && !NullColumnValueGetter.isNullURI(volume.getId())) {
        VirtualArray varray = _dbClient.queryObject(VirtualArray.class, volume.getVirtualArray());
        VirtualPool vpool = _dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
        ProtectionSystem ps = _dbClient.queryObject(ProtectionSystem.class, volume.getProtectionController());
        BlockConsistencyGroup consistencyGroup = _dbClient.queryObject(BlockConsistencyGroup.class, volume.getConsistencyGroup());
        buf.append(String.format("%nPreparing RP %s Volume:%n", volume.getPersonality()));
        buf.append(String.format("\t Name : [%s] (%s)%n", volume.getLabel(), volume.getId()));
        buf.append(String.format("\t Personality : [%s]%n", volume.getPersonality()));
        if (RPHelper.isVPlexVolume(volume, _dbClient) && (null != volume.getAssociatedVolumes())) {
            buf.append(String.format("\t VPLEX : [%s] %n", ((volume.getAssociatedVolumes().size() > 1) ? "Distributed" : "Local")));
            buf.append(String.format("\t\t====="));
            for (String uriString : volume.getAssociatedVolumes()) {
                Volume backingVolume = _dbClient.queryObject(Volume.class, URI.create(uriString));
                VirtualArray backingVolumeVarray = _dbClient.queryObject(VirtualArray.class, backingVolume.getVirtualArray());
                VirtualPool backingVolumeVpool = _dbClient.queryObject(VirtualPool.class, backingVolume.getVirtualPool());
                StorageSystem backingVolumeStorageSystem = _dbClient.queryObject(StorageSystem.class, backingVolume.getStorageController());
                StoragePool backingVolumePool = _dbClient.queryObject(StoragePool.class, backingVolume.getPool());
                buf.append(String.format("%n\t\t Backing Volume Name : [%s] (%s)%n", backingVolume.getLabel(), backingVolume.getId()));
                buf.append(String.format("\t\t Backing Volume Virtual Array : [%s] (%s) %n", backingVolumeVarray.getLabel(), backingVolumeVarray.getId()));
                buf.append(String.format("\t\t Backing Volume Virtual Pool : [%s] (%s) %n", backingVolumeVpool.getLabel(), backingVolumeVpool.getId()));
                buf.append(String.format("\t\t Backing Volume Storage System : [%s] (%s) %n", backingVolumeStorageSystem.getLabel(), backingVolumeStorageSystem.getId()));
                buf.append(String.format("\t\t Backing Volume Storage Pool : [%s] (%s) %n", backingVolumePool.getLabel(), backingVolumePool.getId()));
                if (NullColumnValueGetter.isNotNullValue(backingVolume.getInternalSiteName())) {
                    String internalSiteName = ((ps.getRpSiteNames() != null) ? ps.getRpSiteNames().get(backingVolume.getInternalSiteName()) : backingVolume.getInternalSiteName());
                    buf.append(String.format("\t\t Backing Volume RP Internal Site : [%s %s] %n", internalSiteName, backingVolume.getInternalSiteName()));
                    buf.append(String.format("\t\t Backing Volume RP Copy Name : [%s] %n", backingVolume.getRpCopyName()));
                }
            }
            buf.append(String.format("\t\t=====%n"));
        }
        buf.append(String.format("\t Consistency Group : [%s] (%s)%n", consistencyGroup.getLabel(), consistencyGroup.getId()));
        buf.append(String.format("\t Virtual Array : [%s] (%s)%n", varray.getLabel(), varray.getId()));
        buf.append(String.format("\t Virtual Pool : [%s] (%s)%n", vpool.getLabel(), vpool.getId()));
        buf.append(String.format("\t Capacity : [%s] %n", volume.getCapacity()));
        if (!NullColumnValueGetter.isNullURI(volume.getStorageController())) {
            StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, volume.getStorageController());
            buf.append(String.format("\t Storage System : [%s] (%s)%n", storageSystem.getLabel(), storageSystem.getId()));
        }
        if (!NullColumnValueGetter.isNullURI(volume.getPool())) {
            StoragePool pool = _dbClient.queryObject(StoragePool.class, volume.getPool());
            buf.append(String.format("\t Storage Pool : [%s] (%s)%n", pool.getLabel(), pool.getId()));
        }
        if (!NullColumnValueGetter.isNullURI(volume.getAutoTieringPolicyUri())) {
            AutoTieringPolicy policy = _dbClient.queryObject(AutoTieringPolicy.class, volume.getAutoTieringPolicyUri());
            buf.append(String.format("\t Auto Tier Policy : [%s]%n", policy.getPolicyName()));
        }
        buf.append(String.format("\t RP Protection System : [%s] (%s)%n", ps.getLabel(), ps.getId()));
        buf.append(String.format("\t RP Replication Set : [%s]%n", volume.getRSetName()));
        if (Volume.PersonalityTypes.SOURCE.name().equals(volume.getPersonality())) {
            buf.append(String.format("\t RP MetroPoint enabled : [%s]%n", (VirtualPool.vPoolSpecifiesMetroPoint(vpool) ? "true" : "false")));
        }
        if (volume.getRpTargets() != null && !volume.getRpTargets().isEmpty()) {
            buf.append(String.format("\t RP Target Volume(s) for Source : ["));
            for (String targetVolumeId : volume.getRpTargets()) {
                Volume targetVolume = _dbClient.queryObject(Volume.class, URI.create(targetVolumeId));
                buf.append(String.format("%s, ", targetVolume.getLabel()));
            }
            int endIndex = buf.length();
            buf.delete(endIndex - 2, endIndex);
            buf.append(String.format("]%n"));
        }
        String internalSiteName = ((ps.getRpSiteNames() != null) ? ps.getRpSiteNames().get(volume.getInternalSiteName()) : volume.getInternalSiteName());
        buf.append(String.format("\t RP Internal Site : [%s %s]%n", internalSiteName, volume.getInternalSiteName()));
        buf.append(String.format("\t RP Copy Name : [%s]%n", volume.getRpCopyName()));
    }
    return buf.toString();
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) VirtualArray(com.emc.storageos.db.client.model.VirtualArray) StoragePool(com.emc.storageos.db.client.model.StoragePool) Volume(com.emc.storageos.db.client.model.Volume) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) ProtectionSystem(com.emc.storageos.db.client.model.ProtectionSystem) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

AutoTieringPolicy (com.emc.storageos.db.client.model.AutoTieringPolicy)37 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)19 URI (java.net.URI)18 ArrayList (java.util.ArrayList)12 StoragePool (com.emc.storageos.db.client.model.StoragePool)6 HashSet (java.util.HashSet)6 List (java.util.List)5 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)4 StringSet (com.emc.storageos.db.client.model.StringSet)4 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)4 HashMap (java.util.HashMap)4 CIMObjectPath (javax.cim.CIMObjectPath)4 StorageTier (com.emc.storageos.db.client.model.StorageTier)3 AutoTierPolicyList (com.emc.storageos.model.block.tier.AutoTierPolicyList)3 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)3 Volume (com.emc.storageos.db.client.model.Volume)2 IOException (java.io.IOException)2 Iterator (java.util.Iterator)2 CIMInstance (javax.cim.CIMInstance)2 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)1