Search in sources :

Example 11 with AccessProfile

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

the class SupportedAsynchronousActionsProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        _log.info("***Inside SupportedAsynchronousActionsProcessor****");
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        Iterator<CIMInstance> iterator = (Iterator<CIMInstance>) resultObj;
        while (iterator.hasNext()) {
            CIMInstance instance = iterator.next();
            UnsignedInteger16[] supportedAsyncActions = (UnsignedInteger16[]) instance.getPropertyValue(Constants.SUPPORTED_ASYNCHRONOUS_ACTIONS);
            StorageSystem device = getStorageSystem(_dbClient, profile.getSystemId());
            addSupportedAsynchronousActionsToStorageSystem(supportedAsyncActions, device);
            StringSet replicationTypes = new StringSet();
            replicationTypes.add(SupportedReplicationTypes.LOCAL.toString());
            device.setSupportedReplicationTypes(replicationTypes);
        }
    } catch (Exception e) {
        _log.error("Supported asynchronous action processing failed", e);
    }
}
Also used : Iterator(java.util.Iterator) StringSet(com.emc.storageos.db.client.model.StringSet) AccessProfile(com.emc.storageos.plugins.AccessProfile) CIMInstance(javax.cim.CIMInstance) UnsignedInteger16(javax.cim.UnsignedInteger16) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 12 with AccessProfile

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

the class TCPProtocolEndPointProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        StorageSystem device = getStorageSystem(_dbClient, profile.getSystemId());
        while (it.hasNext()) {
            CIMInstance tcpPointInstance = null;
            StoragePort port = null;
            try {
                tcpPointInstance = it.next();
                String portInstanceID = tcpPointInstance.getObjectPath().getKey(SYSTEMNAME).getValue().toString();
                port = checkEthernetStoragePortExistsInDB(getCIMPropertyValue(tcpPointInstance, NAME), _dbClient, device);
                updateTCPEndPointDetails(keyMap, port, tcpPointInstance, portInstanceID);
            } catch (Exception e) {
                _logger.warn("Port TCP End Point Discovery failed for {}-->{}", "", getMessage(e));
            }
        }
    } catch (Exception e) {
        _logger.error("Port TCP End Point Discovery failed -->{}", getMessage(e));
    }
}
Also used : Iterator(java.util.Iterator) StoragePort(com.emc.storageos.db.client.model.StoragePort) AccessProfile(com.emc.storageos.plugins.AccessProfile) CIMInstance(javax.cim.CIMInstance) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 13 with AccessProfile

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

the class VmaxSLOBookkeepingProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    DbClient dbClient = (DbClient) keyMap.get(Constants.dbClient);
    Set<String> policyNames = (Set<String>) keyMap.get(Constants.SLO_NAMES);
    AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
    StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, profile.getSystemId());
    boolean isVmax3 = storageSystem.checkIfVmax3();
    if (isVmax3 && policyNames != null && !policyNames.isEmpty()) {
        try {
            performPolicyBookKeeping(dbClient, policyNames, storageSystem);
        } catch (IOException e) {
            log.error("Exception caught while trying to run bookkeeping on VMAX3 SLO AutoTieringPolicies", e);
        }
    }
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) Set(java.util.Set) AccessProfile(com.emc.storageos.plugins.AccessProfile) IOException(java.io.IOException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 14 with AccessProfile

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

the class VolumeSizeProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    DbClient _dbClient;
    AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
    try {
        String minVolSize = null;
        String maxVolSize = null;
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        StorageSystem device = getStorageSystem(_dbClient, profile.getSystemId());
        if (resultObj instanceof CIMArgument<?>[]) {
            CIMArgument<?>[] outputArguments = (CIMArgument<?>[]) resultObj;
            for (CIMArgument<?> outArg : outputArguments) {
                if (null == outArg) {
                    continue;
                }
                if (outArg.getName().equalsIgnoreCase(MINIMUM_VOLUME_SIZE)) {
                    minVolSize = outArg.getValue().toString();
                } else if (outArg.getName().equalsIgnoreCase(MAXIMUM_VOLUME_SIZE)) {
                    maxVolSize = outArg.getValue().toString();
                }
            }
            // we are setting at compile time, hence value will be there always.
            CIMObjectPath poolObjectPath = getObjectPathfromCIMArgument();
            String instanceID = poolObjectPath.getKey(Constants.INSTANCEID).getValue().toString();
            StoragePool pool = checkStoragePoolExistsInDB(getNativeIDFromInstance(instanceID), _dbClient, device);
            if (null != pool) {
                Long maxVolumeSize = ControllerUtils.convertBytesToKBytes(maxVolSize);
                Long minVolumeSize = ControllerUtils.convertBytesToKBytes(minVolSize);
                if (Type.ibmxiv.name().equals((device.getSystemType()))) {
                    String supportedResourceType = pool.getSupportedResourceTypes();
                    if (SupportedResourceTypes.THIN_ONLY.name().equals(supportedResourceType)) {
                        pool.setMaximumThinVolumeSize(maxVolumeSize);
                        pool.setMinimumThinVolumeSize(minVolumeSize);
                    } else if (SupportedResourceTypes.THICK_ONLY.name().equals(supportedResourceType)) {
                        pool.setMaximumThickVolumeSize(maxVolumeSize);
                        pool.setMinimumThickVolumeSize(minVolumeSize);
                    }
                } else {
                    // TODO - could this be changed to use the same logic as for IBM pool?
                    // if the result is obtained from calling on Thick, use thick volume size else thin
                    String elementType = determineCallType();
                    if (elementType.equalsIgnoreCase(FIVE)) {
                        pool.setMaximumThinVolumeSize(maxVolumeSize);
                        pool.setMinimumThinVolumeSize(minVolumeSize);
                    } else if (elementType.equalsIgnoreCase(THREE)) {
                        pool.setMaximumThickVolumeSize(maxVolumeSize);
                        pool.setMinimumThickVolumeSize(minVolumeSize);
                    }
                }
                _logger.info(String.format("Maximum limits for volume capacity in storage pool: %s  %n   max thin volume capacity: %s, max thick volume capacity: %s ", pool.getId(), pool.getMaximumThinVolumeSize(), pool.getMaximumThickVolumeSize()));
                _dbClient.persistObject(pool);
            }
        }
    } catch (Exception e) {
        _logger.error("Failed while processing Result : ", e);
    }
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) StoragePool(com.emc.storageos.db.client.model.StoragePool) CIMObjectPath(javax.cim.CIMObjectPath) AccessProfile(com.emc.storageos.plugins.AccessProfile) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) CIMArgument(javax.cim.CIMArgument)

Example 15 with AccessProfile

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

the class PoolCapabilitiesProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        StorageSystem device = getStorageSystem(_dbClient, profile.getSystemId());
        // Process the response only for vmax3 systems.
        if (device.checkIfVmax3()) {
            while (it.hasNext()) {
                CIMInstance capabilitiesInstance = null;
                try {
                    capabilitiesInstance = it.next();
                    String instanceID = capabilitiesInstance.getPropertyValue(Constants.INSTANCEID).toString();
                    addPath(keyMap, operation.getResult(), capabilitiesInstance.getObjectPath());
                } catch (Exception e) {
                    _logger.warn("Pool Capabilities detailed discovery failed for {}-->{}", capabilitiesInstance.getObjectPath(), getMessage(e));
                }
            }
        }
    } catch (Exception e) {
        _logger.error("Pool Capabilities detailed discovery failed", e);
    }
}
Also used : Iterator(java.util.Iterator) AccessProfile(com.emc.storageos.plugins.AccessProfile) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

AccessProfile (com.emc.storageos.plugins.AccessProfile)49 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)33 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)30 Iterator (java.util.Iterator)25 CIMInstance (javax.cim.CIMInstance)24 CIMObjectPath (javax.cim.CIMObjectPath)16 URI (java.net.URI)14 DbClient (com.emc.storageos.db.client.DbClient)12 List (java.util.List)11 IOException (java.io.IOException)9 ArrayList (java.util.ArrayList)9 Map (java.util.Map)9 Stat (com.emc.storageos.db.client.model.Stat)8 StoragePool (com.emc.storageos.db.client.model.StoragePool)7 SMIPluginException (com.emc.storageos.plugins.metering.smis.SMIPluginException)7 StoragePort (com.emc.storageos.db.client.model.StoragePort)6 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)5 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5 CIMArgument (javax.cim.CIMArgument)4