Search in sources :

Example 1 with VNXeStorageTier

use of com.emc.storageos.vnxe.models.VNXeStorageTier 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 2 with VNXeStorageTier

use of com.emc.storageos.vnxe.models.VNXeStorageTier in project coprhd-controller by CoprHD.

the class ApiClientTest method getStorageTier.

// @Test
public void getStorageTier() {
    List<VNXeStorageTier> tiers = apiClient.getStorageTiers();
    for (VNXeStorageTier tier : tiers) {
        System.out.println(tier.getSizeTotal());
        System.out.println(VNXeUtils.convertDoubleSizeToViPRLong(tier.getSizeTotal()));
    }
}
Also used : VNXeStorageTier(com.emc.storageos.vnxe.models.VNXeStorageTier)

Example 3 with VNXeStorageTier

use of com.emc.storageos.vnxe.models.VNXeStorageTier in project coprhd-controller by CoprHD.

the class VNXeCommunicationInterface method discoverStorageTier.

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);
        if (results.iterator().hasNext()) {
            _logger.info("Getting the storage tier.");
            StorageTier tmpTier = _dbClient.queryObject(StorageTier.class, results.iterator().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.getName());
        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) List(java.util.List) ArrayList(java.util.ArrayList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList)

Aggregations

VNXeStorageTier (com.emc.storageos.vnxe.models.VNXeStorageTier)3 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)2 StorageTier (com.emc.storageos.db.client.model.StorageTier)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 URI (java.net.URI)1