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;
}
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()));
}
}
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;
}
Aggregations