Search in sources :

Example 1 with StorageTier

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;
}
Also used : MapStorageTier(com.emc.storageos.api.mapper.functions.MapStorageTier) StorageTier(com.emc.storageos.db.client.model.StorageTier)

Example 2 with StorageTier

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;
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) StorageTier(com.emc.storageos.db.client.model.StorageTier) StorageTierList(com.emc.storageos.model.block.tier.StorageTierList) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 3 with StorageTier

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;
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) StorageTier(com.emc.storageos.db.client.model.StorageTier) StorageTierList(com.emc.storageos.model.block.tier.StorageTierList) URI(java.net.URI) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 4 with StorageTier

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;
}
Also used : HashMap(java.util.HashMap) VNXeStorageTier(com.emc.storageos.vnxe.models.VNXeStorageTier) StorageTier(com.emc.storageos.db.client.model.StorageTier) VNXeStorageTier(com.emc.storageos.vnxe.models.VNXeStorageTier) ArrayList(java.util.ArrayList) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Example 5 with StorageTier

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);
        }
    }
}
Also used : StorageTier(com.emc.storageos.db.client.model.StorageTier) URI(java.net.URI)

Aggregations

StorageTier (com.emc.storageos.db.client.model.StorageTier)17 URI (java.net.URI)7 ArrayList (java.util.ArrayList)5 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)4 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)4 MapStorageTier (com.emc.storageos.api.mapper.functions.MapStorageTier)3 AutoTieringPolicy (com.emc.storageos.db.client.model.AutoTieringPolicy)3 StoragePool (com.emc.storageos.db.client.model.StoragePool)3 StorageTierList (com.emc.storageos.model.block.tier.StorageTierList)3 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 List (java.util.List)3 CIMInstance (javax.cim.CIMInstance)3 CIMObjectPath (javax.cim.CIMObjectPath)3 VNXeStorageTier (com.emc.storageos.vnxe.models.VNXeStorageTier)2 IOException (java.io.IOException)2 Iterator (java.util.Iterator)2 StringSet (com.emc.storageos.db.client.model.StringSet)1 StoragePoolTier (com.emc.storageos.hds.model.StoragePoolTier)1