use of com.emc.storageos.db.client.model.StorageTier in project coprhd-controller by CoprHD.
the class StorageTierService method queryResource.
@Override
protected StorageTier queryResource(URI id) {
ArgValidator.checkUri(id);
StorageTier tier = _dbClient.queryObject(StorageTier.class, id);
ArgValidator.checkEntityNotNull(tier, id, isIdEmbeddedInURL(id));
return tier;
}
use of com.emc.storageos.db.client.model.StorageTier in project coprhd-controller by CoprHD.
the class StoragePoolService method getStorageTiers.
/**
* Get Storage tiers associated with given Pool
* Vmax pools, only one tier will be present always
* Vnx pools can have multiple tiers.
*
* @param id the URN of a ViPR storage pool.
*
* @brief List storage pool storage tiers
* @return A StorageTierList reference specifying the data for the
* storage tier with the passed id.
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/storage-tiers")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public StorageTierList getStorageTiers(@PathParam("id") URI id) {
ArgValidator.checkFieldUriType(id, StoragePool.class, "id");
StoragePool storagePool = queryRegisteredResource(id);
ArgValidator.checkEntity(storagePool, id, isIdEmbeddedInURL(id));
if (storagePool.getTiers() == null) {
throw APIException.badRequests.invalidParameterStoragePoolHasNoTiers(id);
}
StorageTierList storageTierList = new StorageTierList();
for (String tierUri : storagePool.getTiers()) {
StorageTier tier = _dbClient.queryObject(StorageTier.class, URI.create(tierUri));
if (null != tier) {
storageTierList.getStorageTiers().add(toNamedRelatedResource(tier, tier.getNativeGuid()));
}
}
return storageTierList;
}
use of com.emc.storageos.db.client.model.StorageTier 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.StorageTier in project coprhd-controller by CoprHD.
the class VNXUnityCommunicationInterface method discoverStorageTier.
/**
* Discover StorageTiers
*
* @param system
* @param client
* @return
* @throws VNXeException
*/
private HashMap<String, List<StorageTier>> discoverStorageTier(StorageSystem system, VNXeApiClient client) throws VNXeException {
HashMap<String, List<StorageTier>> storageTiers = new HashMap<String, List<StorageTier>>();
List<StorageTier> newTiers = new ArrayList<StorageTier>();
List<StorageTier> existingTiers = new ArrayList<StorageTier>();
List<VNXeStorageTier> tiers = client.getStorageTiers();
String systemNativeGuid = NativeGUIDGenerator.generateNativeGuid(system);
for (VNXeStorageTier tier : tiers) {
String nativeId = tier.getId();
StorageTier tierObj = null;
String tierNativeGuid = NativeGUIDGenerator.generateStorageTierNativeGuidForVmaxTier(systemNativeGuid, nativeId);
URIQueryResultList results = new URIQueryResultList();
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getStorageTierByIdConstraint(tierNativeGuid), results);
Iterator<URI> it = results.iterator();
if (it.hasNext()) {
_logger.info("Getting the storage tier.");
StorageTier tmpTier = _dbClient.queryObject(StorageTier.class, it.next());
_logger.info(String.format("Actual StorageDevice %s : storage tier : %s", system.getId(), tmpTier.getNativeGuid()));
tierObj = tmpTier;
}
boolean isNewTier = false;
if (null == tierObj) {
tierObj = new StorageTier();
tierObj.setId(URIUtil.createId(StorageTier.class));
tierObj.setNativeGuid(tierNativeGuid);
isNewTier = true;
}
tierObj.setLabel(tier.getId());
tierObj.setTotalCapacity(VNXeUtils.convertDoubleSizeToViPRLong(tier.getSizeTotal()));
if (isNewTier) {
newTiers.add(tierObj);
} else {
existingTiers.add(tierObj);
}
}
storageTiers.put(NEW, newTiers);
storageTiers.put(EXISTING, existingTiers);
return storageTiers;
}
use of com.emc.storageos.db.client.model.StorageTier in project coprhd-controller by CoprHD.
the class TierBookKeepingProcessor method performStorageTierBookKeeping.
/**
* perform Storage Tier BookKeeping
*
* @throws IOException
*/
private void performStorageTierBookKeeping(URI storageSystemUri) throws IOException {
List<URI> storageTierUris = _dbClient.queryByConstraint(ContainmentConstraint.Factory.getStorageDeviceStorageTierConstraint(storageSystemUri));
List<StorageTier> storageTiers = _dbClient.queryObject(StorageTier.class, storageTierUris);
for (StorageTier tier : storageTiers) {
if (!_tierNativeGuids.contains(tier.getNativeGuid())) {
tier.setInactive(true);
_dbClient.persistObject(tier);
}
}
}
Aggregations