Search in sources :

Example 6 with AutoTieringPolicy

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

the class AutoTieringService method queryResource.

/**
 * Gets the AutoTier Policy with the passed id from the database.
 *
 * @param id the URN of a ViPR auto tier policy
 *
 * @return A reference to the registered Policy.
 */
@Override
protected DataObject queryResource(URI id) {
    ArgValidator.checkUri(id);
    AutoTieringPolicy autoTierPolicy = _dbClient.queryObject(AutoTieringPolicy.class, id);
    ArgValidator.checkEntityNotNull(autoTierPolicy, id, isIdEmbeddedInURL(id));
    return autoTierPolicy;
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy)

Example 7 with AutoTieringPolicy

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

the class VirtualArrayService method getAutoTierPolicies.

/**
 * get Policies which satisfy the below
 * 1. if policy is enabled
 * 2. if is enabled on associated Storage System.
 * 3. Policy's provisioning Type equals given provisioningType
 */
private AutoTierPolicyList getAutoTierPolicies(String provisionType, Set<URI> autoTierPolicyUris, boolean uniquePolicyNames) {
    AutoTierPolicyList result = new AutoTierPolicyList();
    List<URI> autoTierPolicyUriList = new ArrayList<>(autoTierPolicyUris);
    Iterator<AutoTieringPolicy> autoTierPolicies = _dbClient.queryIterativeObjects(AutoTieringPolicy.class, autoTierPolicyUriList, true);
    Map<URI, StorageSystem> systemCache = new HashMap<>();
    while (autoTierPolicies.hasNext()) {
        AutoTieringPolicy policy = autoTierPolicies.next();
        // If policy is disabled, skip it
        if (!policy.getPolicyEnabled()) {
            continue;
        }
        if (!doesGivenProvisionTypeMatchAutoTierPolicy(provisionType, policy)) {
            continue;
        }
        StorageSystem system = systemCache.get(policy.getStorageSystem());
        if (system == null) {
            system = _dbClient.queryObject(StorageSystem.class, policy.getStorageSystem());
            systemCache.put(policy.getStorageSystem(), system);
        }
        // if is disabled then skip it too.
        if (null != system && system.getAutoTieringEnabled()) {
            addAutoTierPolicy(policy, result, uniquePolicyNames);
        }
    }
    return result;
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) AutoTierPolicyList(com.emc.storageos.model.block.tier.AutoTierPolicyList) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) VirtualArrayList(com.emc.storageos.model.varray.VirtualArrayList) URI(java.net.URI) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 8 with AutoTieringPolicy

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

the class ExternalBlockStorageDevice method addAutoTieringPolicyCapability.

/**
 * Create the auto tiering policy capability and add it to the passed
 * storage capabilities
 *
 * @param storageCapabilities A reference to all storage capabilities.
 * @param autoTieringPolicyURI The URI of the AutoTieringPolicy or null.
 */
private void addAutoTieringPolicyCapability(StorageCapabilities storageCapabilities, URI autoTieringPolicyURI) {
    if (!NullColumnValueGetter.isNullURI(autoTieringPolicyURI)) {
        AutoTieringPolicy autoTieringPolicy = dbClient.queryObject(AutoTieringPolicy.class, autoTieringPolicyURI);
        if (autoTieringPolicy == null) {
            throw DeviceControllerException.exceptions.objectNotFound(autoTieringPolicyURI);
        }
        // Create the auto tiering policy capability.
        AutoTieringPolicyCapabilityDefinition capabilityDefinition = new AutoTieringPolicyCapabilityDefinition();
        Map<String, List<String>> capabilityProperties = new HashMap<>();
        capabilityProperties.put(AutoTieringPolicyCapabilityDefinition.PROPERTY_NAME.POLICY_ID.name(), Arrays.asList(autoTieringPolicy.getPolicyName()));
        capabilityProperties.put(AutoTieringPolicyCapabilityDefinition.PROPERTY_NAME.PROVISIONING_TYPE.name(), Arrays.asList(autoTieringPolicy.getProvisioningType()));
        CapabilityInstance autoTieringCapability = new CapabilityInstance(capabilityDefinition.getId(), autoTieringPolicy.getPolicyName(), capabilityProperties);
        // Get the common capabilities for the passed storage capabilities.
        // If null, create and set it.
        CommonStorageCapabilities commonCapabilities = storageCapabilities.getCommonCapabilitis();
        if (commonCapabilities == null) {
            commonCapabilities = new CommonStorageCapabilities();
            storageCapabilities.setCommonCapabilitis(commonCapabilities);
        }
        // Get the data storage service options for the common capabilities.
        // If null, create it and set it.
        List<DataStorageServiceOption> dataStorageSvcOptions = commonCapabilities.getDataStorage();
        if (dataStorageSvcOptions == null) {
            dataStorageSvcOptions = new ArrayList<>();
            commonCapabilities.setDataStorage(dataStorageSvcOptions);
        }
        // Create a new data storage service option for the AutoTiering policy capability
        // and add it to the list.
        DataStorageServiceOption dataStorageSvcOption = new DataStorageServiceOption(Arrays.asList(autoTieringCapability));
        dataStorageSvcOptions.add(dataStorageSvcOption);
    }
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) HashMap(java.util.HashMap) CommonStorageCapabilities(com.emc.storageos.storagedriver.storagecapabilities.CommonStorageCapabilities) CapabilityInstance(com.emc.storageos.storagedriver.storagecapabilities.CapabilityInstance) DataStorageServiceOption(com.emc.storageos.storagedriver.storagecapabilities.DataStorageServiceOption) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) AutoTieringPolicyCapabilityDefinition(com.emc.storageos.storagedriver.storagecapabilities.AutoTieringPolicyCapabilityDefinition)

Example 9 with AutoTieringPolicy

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

the class VNXUnityCommunicationInterface method discoverAutoTierPolicies.

/**
 * Discover autoTier policies
 *
 * @param system
 * @param apiClient
 * @return
 */
private HashMap<String, List<AutoTieringPolicy>> discoverAutoTierPolicies(StorageSystem system, VNXeApiClient apiClient) {
    HashMap<String, List<AutoTieringPolicy>> policies = new HashMap<String, List<AutoTieringPolicy>>();
    List<AutoTieringPolicy> newPolicies = new ArrayList<AutoTieringPolicy>();
    List<AutoTieringPolicy> updatePolicies = new ArrayList<AutoTieringPolicy>();
    String[] tierPolicies = apiClient.getAutoTierPolicies();
    String systemNativeGuid = NativeGUIDGenerator.generateNativeGuid(system);
    for (String policyName : tierPolicies) {
        String policyNativeGuid = NativeGUIDGenerator.generateAutoTierPolicyNativeGuid(systemNativeGuid, policyName, NativeGUIDGenerator.FASTPOLICY);
        URIQueryResultList result = new URIQueryResultList();
        _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getAutoTieringPolicyByNativeGuidConstraint(policyNativeGuid), result);
        AutoTieringPolicy policy = null;
        if (result.iterator().hasNext()) {
            policy = _dbClient.queryObject(AutoTieringPolicy.class, result.iterator().next());
        }
        boolean newPolicy = false;
        if (null == policy) {
            newPolicy = true;
            policy = new AutoTieringPolicy();
            policy.setId(URIUtil.createId(AutoTieringPolicy.class));
            policy.setStorageSystem(system.getId());
            policy.setNativeGuid(policyNativeGuid);
            policy.setSystemType(system.getSystemType());
        }
        policy.setLabel(policyName);
        policy.setPolicyName(policyName);
        policy.setPolicyEnabled(true);
        policy.setProvisioningType(AutoTieringPolicy.ProvisioningType.All.name());
        if (newPolicy) {
            newPolicies.add(policy);
        } else {
            updatePolicies.add(policy);
        }
    }
    policies.put(NEW, newPolicies);
    policies.put(EXISTING, updatePolicies);
    return policies;
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Example 10 with AutoTieringPolicy

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

the class StoragePoolSettingProcessor method processVMAX3SLO.

/**
 * Validate that this represents a SLO setting. If it does, then process it as an AutoTierPolicy
 *
 * If the CIMInstance has a its EMCFastSetting populated, then this is a SLO policy
 * based StoragePoolSetting. We will extract the SLOName, Workload, and Average response time.
 * These will be populated in the AutoTieringPolicy object (if one needs to be created).
 *
 * Updates 'sloNames' list
 *
 * @param storageSystem [in] - StorageSystem that the setting belongs to
 * @param settingInstance [in] - Should be an instance of Symm_StoragePoolSetting.
 */
private void processVMAX3SLO(StorageSystem storageSystem, CIMInstance settingInstance) {
    String emcFastSetting = (String) settingInstance.getPropertyValue(Constants.EMC_FAST_SETTING);
    if (!Strings.isNullOrEmpty(emcFastSetting)) {
        String slo = (String) settingInstance.getPropertyValue(Constants.EMC_SLO);
        Float avgResponseTimeValue = (Float) settingInstance.getPropertyValue(Constants.EMC_AVG_RESPONSE_TIME);
        if (!Strings.isNullOrEmpty(slo)) {
            String avgResponseTime = Constants.NOT_AVAILABLE;
            if (!checkForNull(avgResponseTimeValue)) {
                avgResponseTime = avgResponseTimeValue.toString();
            }
            String workload = (String) settingInstance.getPropertyValue(Constants.EMC_WORKLOAD);
            workload = Strings.isNullOrEmpty(workload) ? Constants.NONE : workload;
            String sloName = generateSLOPolicyName(slo, workload, avgResponseTime);
            sloNames.add(sloName);
            // This is a SLO policy setting. We can use this to create/update an AutoTieringPolicy
            String sloID = NativeGUIDGenerator.generateAutoTierPolicyNativeGuid(storageSystem.getNativeGuid(), sloName, NativeGUIDGenerator.SLO_POLICY);
            AutoTieringPolicy autoTieringPolicy = getAutoTieringPolicyByNameFromDB(sloID, _dbClient);
            createOrUpdateSLOBasedAutoTierPolicy(storageSystem, autoTieringPolicy, sloID, sloName, slo, workload, avgResponseTime);
        } else {
            _logger.warn(String.format("Setting %s had non-null EMCFastSetting property = '%s', " + "but its EMCSLO and/or EMCApproxAverageResponseTime property is null/empty.", settingInstance.getObjectPath().toString(), emcFastSetting));
        }
    }
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy)

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