Search in sources :

Example 21 with SMIPluginException

use of com.emc.storageos.plugins.metering.smis.SMIPluginException in project coprhd-controller by CoprHD.

the class VolumeProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws SMIPluginException {
    long timeinMilis;
    try {
        timeinMilis = (Long) keyMap.get(Constants._TimeCollected);
        CIMArgument<?>[] outputArguments = (CIMArgument<?>[]) resultObj;
        @SuppressWarnings("unchecked") List<Stat> metricsObjList = (List<Stat>) keyMap.get(Constants._Stats);
        DbClient dbClient = (DbClient) keyMap.get(Constants.dbClient);
        if ((null == outputArguments[0]) || ((String[]) outputArguments[0].getValue()).length == 0) {
            _logger.warn("Empty Statistics response returned from Provider");
            return;
        }
        String[] volumes = ((String[]) outputArguments[0].getValue())[0].split("\n");
        List<String> metricSequence = (List<String>) keyMap.get(Constants.STORAGEOS_VOLUME_MANIFEST);
        _logger.debug("volume metricNames Sequence {}", metricSequence);
        for (String volume : volumes) {
            if (volume.isEmpty()) {
                _logger.debug("Empty Volume returned as part of Statistics Response");
                continue;
            }
            if (null != metricSequence && !metricSequence.isEmpty()) {
                addMetricstoMetricsObject(keyMap, volume, metricsObjList, timeinMilis, metricSequence, dbClient);
            } else {
                _logger.error("failed processing Volume Metric values as metric sequence is null.");
            }
        }
        _zeroRecordGenerator.identifyRecordstobeZeroed(keyMap, metricsObjList, Volume.class);
    } catch (Exception e) {
        _logger.error("Failed while extracting Read & WriteIOs for Volumes : ", e);
    }
    resultObj = null;
}
Also used : Stat(com.emc.storageos.db.client.model.Stat) DbClient(com.emc.storageos.db.client.DbClient) List(java.util.List) SMIPluginException(com.emc.storageos.plugins.metering.smis.SMIPluginException) CIMArgument(javax.cim.CIMArgument)

Example 22 with SMIPluginException

use of com.emc.storageos.plugins.metering.smis.SMIPluginException in project coprhd-controller by CoprHD.

the class ConnectionManagerUtils method allowReaping.

public void allowReaping(Object profile, Object client) throws BaseCollectionException {
    AccessProfile accessProfile = (AccessProfile) profile;
    DbClient dbClient = (DbClient) client;
    try {
        final CIMConnectionFactory connectionFactory = (CIMConnectionFactory) accessProfile.getCimConnectionFactory();
        StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, accessProfile.getSystemId());
        connectionFactory.unsetKeepAliveForConnection(storageSystem);
    } catch (final IllegalStateException ex) {
        log.error("Not able to get CIMOM Client instance for ip {} due to ", accessProfile.getIpAddress(), ex);
        throw new SMIPluginException(SMIPluginException.ERRORCODE_NO_WBEMCLIENT, ex.fillInStackTrace(), ex.getMessage());
    }
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) CIMConnectionFactory(com.emc.storageos.volumecontroller.impl.smis.CIMConnectionFactory) SMIPluginException(com.emc.storageos.plugins.metering.smis.SMIPluginException) AccessProfile(com.emc.storageos.plugins.AccessProfile) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

SMIPluginException (com.emc.storageos.plugins.metering.smis.SMIPluginException)22 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)12 List (java.util.List)7 CIMObjectPath (javax.cim.CIMObjectPath)7 WBEMException (javax.wbem.WBEMException)7 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)6 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)6 AccessProfile (com.emc.storageos.plugins.AccessProfile)6 IOException (java.io.IOException)5 URI (java.net.URI)5 CIMInstance (javax.cim.CIMInstance)5 DbClient (com.emc.storageos.db.client.DbClient)4 Stat (com.emc.storageos.db.client.model.Stat)4 StorageProvider (com.emc.storageos.db.client.model.StorageProvider)3 StorageSystemViewObject (com.emc.storageos.plugins.StorageSystemViewObject)3 LocalReplicaObject (com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.processor.detailedDiscovery.LocalReplicaObject)3 RemoteMirrorObject (com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.processor.detailedDiscovery.RemoteMirrorObject)3 CIMConnectionFactory (com.emc.storageos.volumecontroller.impl.smis.CIMConnectionFactory)3 Iterator (java.util.Iterator)3 CIMArgument (javax.cim.CIMArgument)3