Search in sources :

Example 21 with AutoTieringPolicy

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

the class AutoTieringPolicyMatcher method getAutoTieringPoolsOnHDS.

/**
 * Match the pools based on the policyName selected during vpool create/update.
 *
 * @param policyName - Vpool PolicyName to match.
 * @param attributeMap - AttributeMap.
 * @param pools - Pools to match.
 * @return - list of matched pools.
 */
private List<StoragePool> getAutoTieringPoolsOnHDS(String policyName, Map<String, Object> attributeMap, List<StoragePool> pools) {
    List<StoragePool> filteredPools = new ArrayList<StoragePool>();
    List<URI> systemURIs = new ArrayList<URI>();
    URIQueryResultList result = getAutoTierPolicies(attributeMap, policyName);
    // Iterate through the policies
    Iterator<URI> iterator = result.iterator();
    while (iterator.hasNext()) {
        AutoTieringPolicy policy = _objectCache.queryObject(AutoTieringPolicy.class, iterator.next());
        // If policy is tiering capable.
        if (policy.getPolicyEnabled() && !systemURIs.contains(policy.getStorageSystem())) {
            systemURIs.add(policy.getStorageSystem());
        }
    }
    // process the pools and check if the pool's system matches with the policy system.
    for (StoragePool pool : pools) {
        if (pool.getAutoTieringEnabled() && systemURIs.contains(pool.getStorageDevice())) {
            filteredPools.add(pool);
        }
    }
    return filteredPools;
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) StoragePool(com.emc.storageos.db.client.model.StoragePool) ArrayList(java.util.ArrayList) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Example 22 with AutoTieringPolicy

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

the class AutoTieringPolicyMatcher method fetchFastPoliciesForVMAX.

/**
 * Verify whether policies associated with pool are FAST enabled or not for VMAX storage systems.
 * true: pool has FAST enabled policies.
 * false: pool doesn't support FAST.
 *
 * @param poolID : ID of the Pool.
 * @return
 */
private Set<String> fetchFastPoliciesForVMAX(URI poolID) {
    Set<String> policyNameSet = new HashSet<String>();
    URIQueryResultList fastPolicyResult = new URIQueryResultList();
    _objectCache.getDbClient().queryByConstraint(AlternateIdConstraint.Factory.getPoolFASTPolicyConstraint(poolID.toString()), fastPolicyResult);
    Iterator<URI> fastPolicyItr = fastPolicyResult.iterator();
    while (fastPolicyItr.hasNext()) {
        AutoTieringPolicy tierPolicy = _objectCache.queryObject(AutoTieringPolicy.class, fastPolicyItr.next());
        if (null != tierPolicy && tierPolicy.getPolicyEnabled()) {
            policyNameSet.add(tierPolicy.getPolicyName());
        }
    }
    return policyNameSet;
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) HashSet(java.util.HashSet)

Example 23 with AutoTieringPolicy

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

the class AutoTieringPolicyMatcher method fetchTieringPoliciesForHDS.

/**
 * Check whether tiering is enabled on the given system or not.
 * If true: fetch & return all tiering policies of the system.
 * If false: return nothing.
 *
 * @param device : device of the pool.
 * @return
 */
private Set<String> fetchTieringPoliciesForHDS(StorageSystem device) {
    Set<String> policyNameSet = new HashSet<String>();
    URIQueryResultList tieringPolicyResult = new URIQueryResultList();
    _objectCache.getDbClient().queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceFASTPolicyConstraint(device.getId()), tieringPolicyResult);
    Iterator<URI> tieringPolicyItr = tieringPolicyResult.iterator();
    while (tieringPolicyItr.hasNext()) {
        AutoTieringPolicy tierPolicy = _objectCache.queryObject(AutoTieringPolicy.class, tieringPolicyItr.next());
        if (null != tierPolicy && tierPolicy.getPolicyEnabled()) {
            policyNameSet.add(tierPolicy.getPolicyName());
        }
    }
    return policyNameSet;
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) HashSet(java.util.HashSet)

Example 24 with AutoTieringPolicy

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

the class HDSCommunicationInterface method checkTieringPolicyExistsInDB.

/**
 * Verify whether tieringPolicy already exists in DB or not.
 *
 * @param nativeGuid
 * @return
 */
private AutoTieringPolicy checkTieringPolicyExistsInDB(String nativeGuid) {
    AutoTieringPolicy tieringPolicy = null;
    URIQueryResultList queryResult = new URIQueryResultList();
    // use NativeGuid to lookup Pools in DB
    _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getAutoTieringPolicyByNativeGuidConstraint(nativeGuid), queryResult);
    if (queryResult.iterator().hasNext()) {
        URI tieringPolicyURI = queryResult.iterator().next();
        if (null != tieringPolicyURI) {
            tieringPolicy = _dbClient.queryObject(AutoTieringPolicy.class, tieringPolicyURI);
        }
    }
    return tieringPolicy;
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Example 25 with AutoTieringPolicy

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

the class HDSCommunicationInterface method processDiscoveredTieringPolicies.

/**
 * Process the tieringpolicies received for a given system.
 *
 * @param system
 * @param tpList
 */
private void processDiscoveredTieringPolicies(StorageSystem system, List<TieringPolicy> tpList) {
    List<AutoTieringPolicy> newPolicies = new ArrayList<AutoTieringPolicy>();
    List<AutoTieringPolicy> allPolicies = new ArrayList<AutoTieringPolicy>();
    List<AutoTieringPolicy> updatePolicies = new ArrayList<AutoTieringPolicy>();
    for (TieringPolicy tpFromResponse : tpList) {
        // Ignore all custom tiering policies.
        if (Integer.parseInt(tpFromResponse.getPolicyID()) > 5) {
            _logger.debug("Ignoring custom policy {} on system {} ", tpFromResponse.getPolicyID(), system.getNativeGuid());
            continue;
        }
        String nativeGuid = NativeGUIDGenerator.generateAutoTierPolicyNativeGuid(system.getNativeGuid(), getTieringPolicyLabel(tpFromResponse.getPolicyID()), NativeGUIDGenerator.AUTO_TIERING_POLICY);
        AutoTieringPolicy tieringPolicy = checkTieringPolicyExistsInDB(nativeGuid);
        boolean isNew = false;
        if (null == tieringPolicy) {
            isNew = true;
            tieringPolicy = new AutoTieringPolicy();
            tieringPolicy.setId(URIUtil.createId(AutoTieringPolicy.class));
            tieringPolicy.setPolicyName(getTieringPolicyLabel(tpFromResponse.getPolicyID()));
            tieringPolicy.setStorageSystem(system.getId());
            tieringPolicy.setNativeGuid(nativeGuid);
            tieringPolicy.setLabel(getTieringPolicyLabel(tpFromResponse.getPolicyID()));
            tieringPolicy.setSystemType(Type.hds.name());
            newPolicies.add(tieringPolicy);
        }
        // Hitachi is not providing any API to check whether a policy is enabled or not.
        // Hence enabling by default for all policies.
        tieringPolicy.setPolicyEnabled(Boolean.TRUE);
        tieringPolicy.setProvisioningType(ProvisioningType.ThinlyProvisioned.name());
        if (!isNew) {
            updatePolicies.add(tieringPolicy);
        }
    }
    _dbClient.createObject(newPolicies);
    _dbClient.persistObject(updatePolicies);
    allPolicies.addAll(newPolicies);
    allPolicies.addAll(updatePolicies);
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) HitachiTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy.HitachiTieringPolicy) TieringPolicy(com.emc.storageos.hds.model.TieringPolicy) AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) ArrayList(java.util.ArrayList)

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