use of com.emc.storageos.db.client.model.StoragePool.SupportedResourceTypes in project coprhd-controller by CoprHD.
the class XIVStoragePoolProcessor method processResult.
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
_profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
try {
_newPoolList = new ArrayList<StoragePool>();
_updatePoolList = new ArrayList<StoragePool>();
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
StorageSystem device = getStorageSystem(_dbClient, _profile.getSystemId());
if (SupportedProvisioningTypes.NONE.name().equalsIgnoreCase(device.getSupportedProvisioningType())) {
_logger.info("Storage System doesn't support volume creations :" + device.getLabel());
return;
}
Set<String> protocols = (Set<String>) keyMap.get(Constants.PROTOCOLS);
Map<URI, StoragePool> poolsToMatchWithVpool = new HashMap<URI, StoragePool>();
while (it.hasNext()) {
CIMInstance poolInstance = it.next();
try {
addPath(keyMap, operation.getResult(), poolInstance.getObjectPath());
String hardSizeStr = getCIMPropertyValue(poolInstance, HARD_SIZE);
long hardSize = Long.parseLong(hardSizeStr);
String softSizeStr = getCIMPropertyValue(poolInstance, SOFT_SIZE);
long softSize = Long.parseLong(softSizeStr);
SupportedResourceTypes type = SupportedResourceTypes.THICK_ONLY;
if (hardSize < softSize) {
type = SupportedResourceTypes.THIN_ONLY;
}
createStoragePool(_dbClient, device, poolInstance, PoolClassNames.IBMTSDS_VirtualPool.name(), type.name(), protocols, poolsToMatchWithVpool, _newPoolList, _updatePoolList);
} catch (Exception e) {
_logger.warn("StoragePool Discovery failed for {}", getCIMPropertyValue(poolInstance, Constants.INSTANCEID), getMessage(e));
}
}
// set the pools whose properties got changed.
keyMap.put(Constants.MODIFIED_STORAGEPOOLS, poolsToMatchWithVpool);
_dbClient.createObject(_newPoolList);
_dbClient.updateAndReindexObject(_updatePoolList);
// find the pools not visible in this discovery
List<StoragePool> discoveredPools = new ArrayList<StoragePool>(_newPoolList);
discoveredPools.addAll(_updatePoolList);
List<StoragePool> notVisiblePools = DiscoveryUtils.checkStoragePoolsNotVisible(discoveredPools, _dbClient, device.getId());
for (StoragePool notVisiblePool : notVisiblePools) {
poolsToMatchWithVpool.put(notVisiblePool.getId(), notVisiblePool);
}
// If any storage ports on the storage system are in a transport
// zone, there is an implicit connection to the transport zone
// varray. We need to add these implicit varray
// connections for the new storage pool.
StoragePoolAssociationHelper.setStoragePoolVarrays(device.getId(), _newPoolList, _dbClient);
} catch (Exception e) {
_logger.error("StoragePool Discovery failed", e);
} finally {
_newPoolList = null;
_updatePoolList = null;
}
}
Aggregations