use of com.emc.storageos.db.client.model.AutoTieringPolicy in project coprhd-controller by CoprHD.
the class ControllerUtils method getAutoTieringPolicyName.
public static String getAutoTieringPolicyName(URI uri, DbClient dbClient) {
String policyName = Constants.NONE;
if (URIUtil.isType(uri, Volume.class)) {
Volume volume = dbClient.queryObject(Volume.class, uri);
URI policyURI = volume.getAutoTieringPolicyUri();
if (!NullColumnValueGetter.isNullURI(policyURI)) {
AutoTieringPolicy policy = dbClient.queryObject(AutoTieringPolicy.class, policyURI);
policyName = policy.getPolicyName();
}
} else if (URIUtil.isType(uri, BlockSnapshot.class)) {
BlockSnapshot snapshot = dbClient.queryObject(BlockSnapshot.class, uri);
StorageSystem storage = dbClient.queryObject(StorageSystem.class, snapshot.getStorageController());
if (storage.checkIfVmax3()) {
Volume volume = dbClient.queryObject(Volume.class, snapshot.getParent());
URI policyURI = volume.getAutoTieringPolicyUri();
if (!NullColumnValueGetter.isNullURI(policyURI)) {
AutoTieringPolicy policy = dbClient.queryObject(AutoTieringPolicy.class, policyURI);
policyName = policy.getPolicyName();
}
}
} else if (URIUtil.isType(uri, BlockMirror.class)) {
BlockMirror mirror = dbClient.queryObject(BlockMirror.class, uri);
if (!NullColumnValueGetter.isNullURI(mirror.getAutoTieringPolicyUri())) {
AutoTieringPolicy policy = dbClient.queryObject(AutoTieringPolicy.class, mirror.getAutoTieringPolicyUri());
policyName = policy.getPolicyName();
}
}
return policyName;
}
use of com.emc.storageos.db.client.model.AutoTieringPolicy in project coprhd-controller by CoprHD.
the class VirtualPoolUtil method isAutoTieringPolicyValidForDeviceType.
public static boolean isAutoTieringPolicyValidForDeviceType(String autoTierPolicyName, String systemType, DbClient dbClient) {
if (null == autoTierPolicyName || autoTierPolicyName.equalsIgnoreCase("NONE")) {
return true;
}
URIQueryResultList result = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getFASTPolicyByNameConstraint(autoTierPolicyName), result);
while (result.iterator().hasNext()) {
AutoTieringPolicy policy = dbClient.queryObject(AutoTieringPolicy.class, result.iterator().next());
if (policy == null) {
continue;
}
if (systemType.equalsIgnoreCase(policy.getSystemType())) {
return true;
}
}
return false;
}
use of com.emc.storageos.db.client.model.AutoTieringPolicy in project coprhd-controller by CoprHD.
the class AutoTieringService method getStorageTiersForGivenPolicy.
/**
* Show the storage tiers associated with a specific auto tiering policy
* Only auto tiering policies belonging to VMAX systems have direct association to tiers.
*
* @param id the URN of a ViPR auto tier policy
*
* @prereq none
* @brief List storage tiers for auto tiering policy
* @return Policy Object
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
@Path("/{id}/storage-tiers")
public StorageTierList getStorageTiersForGivenPolicy(@PathParam("id") URI id) {
ArgValidator.checkFieldUriType(id, AutoTieringPolicy.class, "id");
AutoTieringPolicy policy = _dbClient.queryObject(AutoTieringPolicy.class, id);
ArgValidator.checkEntityNotNull(policy, id, isIdEmbeddedInURL(id));
StorageTierList storageTierList = new StorageTierList();
List<URI> tierUris = _dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageTierFASTPolicyConstraint(policy.getId().toString()));
List<StorageTier> tiers = _dbClient.queryObject(StorageTier.class, tierUris);
for (StorageTier tier : tiers) {
storageTierList.getStorageTiers().add(toNamedRelatedResource(tier, tier.getNativeGuid()));
}
return storageTierList;
}
use of com.emc.storageos.db.client.model.AutoTieringPolicy 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.db.client.model.AutoTieringPolicy in project coprhd-controller by CoprHD.
the class AutoTieringService method getAutoTierPolicy.
/**
* Show the specified auto tiering policy.
*
* @param id the URN of a ViPR auto tier policy
* @prereq none
* @brief Show the details of the specified auto tiering policy
* @return Policy Object
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
@Path("/{id}")
public AutoTieringPolicyRestRep getAutoTierPolicy(@PathParam("id") URI id) {
ArgValidator.checkFieldUriType(id, AutoTieringPolicy.class, "id");
AutoTieringPolicy policy = _dbClient.queryObject(AutoTieringPolicy.class, id);
ArgValidator.checkEntityNotNull(policy, id, isIdEmbeddedInURL(id));
return map(policy);
}
Aggregations