Search in sources :

Example 1 with SupportedResourceTypes

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;
    }
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) SupportedResourceTypes(com.emc.storageos.db.client.model.StoragePool.SupportedResourceTypes) ArrayList(java.util.ArrayList) URI(java.net.URI) CIMInstance(javax.cim.CIMInstance) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Iterator(java.util.Iterator) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

StoragePool (com.emc.storageos.db.client.model.StoragePool)1 SupportedResourceTypes (com.emc.storageos.db.client.model.StoragePool.SupportedResourceTypes)1 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)1 IOException (java.io.IOException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 Set (java.util.Set)1 CIMInstance (javax.cim.CIMInstance)1