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;
}
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;
}
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;
}
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;
}
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);
}
Aggregations