use of com.emc.storageos.model.block.tier.AutoTierPolicyList in project coprhd-controller by CoprHD.
the class AutoTieringService method getAutoTierPolicies.
/**
* @param provisionType The provisioning type associated with this policy [Thin,Thick or All]
* @param uniquePolicyNames If unique_auto_tier_policy_names is set to true, then unique auto tier policy Names alone without any
* storage system details will be returned,
* even if the same policy exists in multiple arrays. If unique_auto_tier_policy_names is set to false, then duplicate policy
* names, with the storage system details, are returned
*
* @prereq none
* @brief List all auto tier policies
* @return AutoTierPolicyList
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public AutoTierPolicyList getAutoTierPolicies(@QueryParam("provisioning_type") String provisionType, @QueryParam("unique_auto_tier_policy_names") Boolean uniquePolicyNames) {
if (null == uniquePolicyNames) {
uniquePolicyNames = false;
}
AutoTierPolicyList policyList = new AutoTierPolicyList();
List<URI> policyUris = _dbClient.queryByType(AutoTieringPolicy.class, true);
List<AutoTieringPolicy> policies = _dbClient.queryObject(AutoTieringPolicy.class, policyUris);
for (AutoTieringPolicy policy : policies) {
if (!doesGivenProvisionTypeMatchAutoTierPolicy(provisionType, policy)) {
continue;
}
BlockMapper.addAutoTierPolicy(policy, policyList, uniquePolicyNames);
}
return policyList;
}
use of com.emc.storageos.model.block.tier.AutoTierPolicyList 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;
}
use of com.emc.storageos.model.block.tier.AutoTierPolicyList in project coprhd-controller by CoprHD.
the class AutoTieringPolicies method getByVirtualArrays.
/**
* Gets all auto tier policies for all virtual arrays.
*
* @param virtualArrayIds
* the ID of the virtual array.
* @param provisioningType
* the provisioning type, if null matches any provisioning type.
* @param uniqueNames
* when true duplicate named policies will be ignored.
* @param filter
* @return the list of auto tier policies.
*
* @see #getByRefs(java.util.Collection)
* @see VirtualArrays
*/
public List<AutoTieringPolicyRestRep> getByVirtualArrays(Collection<URI> virtualArrayIds, String provisioningType, Boolean uniqueNames, ResourceFilter<AutoTieringPolicyRestRep> filter) {
UriBuilder builder = client.uriBuilder(PathConstants.AUTO_TIER_FOR_ALL_VARRAY);
if ((provisioningType != null) && (provisioningType.length() > 0)) {
builder.queryParam("provisioning_type", provisioningType);
}
if (uniqueNames != null) {
builder.queryParam("unique_auto_tier_policy_names", uniqueNames);
}
BulkIdParam input = new BulkIdParam((List<URI>) virtualArrayIds);
AutoTierPolicyList response = client.postURI(AutoTierPolicyList.class, input, builder.build());
return defaultList(getByRefs(response.getAutoTierPolicies(), filter));
}
use of com.emc.storageos.model.block.tier.AutoTierPolicyList in project coprhd-controller by CoprHD.
the class StorageSystemService method getAllFastPolicies.
/**
* Gets all AutoTier policies associated with registered storage system with the passed
* id. Only policies which satisfy the below will be returned
* 1. AutoTiering should be enabled on StorageSystem
* 2. AutoTierPolicy should be in Enabled State.
*
* @param id the URN of a ViPR storage system.
* @brief List storage system autotier policies
* @return A reference to a AutoTierPolicy List specifying the id and self link
* for each storage pool.
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/auto-tier-policies")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public AutoTierPolicyList getAllFastPolicies(@PathParam("id") URI id, @QueryParam("unique_policy_names") Boolean uniquePolicyNames) {
// Make sure storage system is registered.
ArgValidator.checkFieldUriType(id, StorageSystem.class, "id");
StorageSystem system = queryRegisteredSystem(id);
if (!system.getAutoTieringEnabled()) {
throw APIException.badRequests.autoTieringNotEnabledOnStorageSystem(id);
}
if (uniquePolicyNames == null) {
uniquePolicyNames = false;
}
AutoTierPolicyList policyList = new AutoTierPolicyList();
URIQueryResultList fastPolicyURIs = new URIQueryResultList();
_dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceFASTPolicyConstraint(id), fastPolicyURIs);
Iterator<URI> fastPolicyIterator = fastPolicyURIs.iterator();
while (fastPolicyIterator.hasNext()) {
URI fastPolicyURI = fastPolicyIterator.next();
AutoTieringPolicy fastPolicy = _dbClient.queryObject(AutoTieringPolicy.class, fastPolicyURI);
if (null != fastPolicy && fastPolicy.getPolicyEnabled()) {
addAutoTierPolicy(fastPolicy, policyList, uniquePolicyNames);
}
}
return policyList;
}
Aggregations