Search in sources :

Example 61 with BaseCollectionException

use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.

the class VNXPolicyToVolumeProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        @SuppressWarnings("unchecked") final Iterator<CIMObjectPath> it = (Iterator<CIMObjectPath>) resultObj;
        // value will be set already always
        Object[] arguments = (Object[]) _args.get(0);
        CIMObjectPath vnxFastPolicyRule = (CIMObjectPath) arguments[0];
        // construct VolumeID-->PolicyRule mapping
        while (it.hasNext()) {
            CIMObjectPath volumePath = it.next();
            String volumeID = volumePath.getKey(Constants.DEVICEID).getValue().toString();
            keyMap.put(volumeID, vnxFastPolicyRule);
            addPath(keyMap, Constants.STORAGEVOLUMES, volumePath);
        }
    } catch (Exception e) {
        _logger.error("FAST Policy Discovery : DiscoveryExtracting Volumes from Policy failed", e);
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) Iterator(java.util.Iterator) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 62 with BaseCollectionException

use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.

the class VNXTierDomainToTiersProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        // indicates ExtremePerformance or Performance or Capacity Tier
        Object[] arguments = (Object[]) _args.get(0);
        CIMObjectPath tierDomainPath = (CIMObjectPath) arguments[0];
        CIMObjectPath storagePoolpath = (CIMObjectPath) keyMap.get(tierDomainPath.getKey(Constants.NAME).getValue());
        addTiersToPool(storagePoolpath, it, _dbClient, keyMap);
    } catch (Exception e) {
        _logger.error("VNX TierDomain to Tier Processing failed :", e);
    }
}
Also used : Iterator(java.util.Iterator) CIMObjectPath(javax.cim.CIMObjectPath) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 63 with BaseCollectionException

use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.

the class VNXVolumesToPoolProcessor method processResult.

/**
 * {@inheritDoc}
 */
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        @SuppressWarnings("unchecked") final Iterator<CIMObjectPath> it = (Iterator<CIMObjectPath>) resultObj;
        // values previously set
        Object[] arguments = (Object[]) _args.get(0);
        CIMObjectPath volumePath = (CIMObjectPath) arguments[0];
        // Mapping had been already constructed between Volumes --> Policy in previous SMI-S Call
        // while getting Policy--->Volumes for VNX
        CIMObjectPath policyPath = (CIMObjectPath) keyMap.get(volumePath.getKey(Constants.DEVICEID).getValue());
    // add Pools to POlicy
    // addStoragePoolstoPolicy(policyPath, it, _dbClient,keyMap);
    } catch (Exception e) {
        _logger.error("Extracting Pools from Volumnes failed on FAST Polciy Discovery", e);
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) Iterator(java.util.Iterator) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 64 with BaseCollectionException

use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.

the class XIVStorageConfigurationCapabilitiesProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
    _profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
    _dbClient = (DbClient) keyMap.get(Constants.dbClient);
    try {
        StorageSystem system = _dbClient.queryObject(StorageSystem.class, _profile.getSystemId());
        while (it.hasNext()) {
            CIMInstance storageConfigurationInstance = it.next();
            UnsignedInteger16[] supportedElementTypeArr = (UnsignedInteger16[]) storageConfigurationInstance.getPropertyValue(SUPPORTED_ELEMENT_TYPES);
            String supportedElementTypes = Arrays.toString(supportedElementTypeArr);
            if (_logger.isDebugEnabled()) {
                _logger.debug("Capability:" + supportedElementTypes);
            }
            if (supportedElementTypes.contains(THIN_VOLUME_SUPPORTED) && supportedElementTypes.contains(THICK_VOLUME_SUPPORTED)) {
                system.setSupportedProvisioningType(SupportedProvisioningTypes.THIN_AND_THICK.name());
            } else if (supportedElementTypes.contains(THIN_VOLUME_SUPPORTED)) {
                system.setSupportedProvisioningType(SupportedProvisioningTypes.THIN.name());
            } else if (supportedElementTypes.contains(THICK_VOLUME_SUPPORTED)) {
                system.setSupportedProvisioningType(SupportedProvisioningTypes.THICK.name());
            } else {
                system.setSupportedProvisioningType(SupportedProvisioningTypes.NONE.name());
            }
            // should have only one instance
            break;
        }
        _dbClient.persistObject(system);
    } catch (Exception e) {
        _logger.error("Finding out Storage System Capability on Volume Creation failed: ", e);
    }
}
Also used : Iterator(java.util.Iterator) CIMInstance(javax.cim.CIMInstance) UnsignedInteger16(javax.cim.UnsignedInteger16) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 65 with BaseCollectionException

use of com.emc.storageos.plugins.BaseCollectionException 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

BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)185 Iterator (java.util.Iterator)66 CIMInstance (javax.cim.CIMInstance)66 CIMObjectPath (javax.cim.CIMObjectPath)59 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)55 IOException (java.io.IOException)47 URI (java.net.URI)47 ArrayList (java.util.ArrayList)47 PostMethod (org.apache.commons.httpclient.methods.PostMethod)36 ResponsePacket (com.emc.nas.vnxfile.xmlapi.ResponsePacket)35 Status (com.emc.nas.vnxfile.xmlapi.Status)33 AccessProfile (com.emc.storageos.plugins.AccessProfile)30 List (java.util.List)30 Map (java.util.Map)30 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)28 StoragePool (com.emc.storageos.db.client.model.StoragePool)27 Header (org.apache.commons.httpclient.Header)27 StoragePort (com.emc.storageos.db.client.model.StoragePort)22 HashSet (java.util.HashSet)18 URISyntaxException (java.net.URISyntaxException)17