Search in sources :

Example 66 with CIMInstance

use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.

the class XIVSupportedAsynchronousActionsProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        _log.info("processResult");
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        @SuppressWarnings("unchecked") 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());
            StringSet supportedAsyncActionsSet = new StringSet();
            if (supportedAsyncActions != null) {
                for (UnsignedInteger16 actionValue : supportedAsyncActions) {
                    switch(actionValue.intValue()) {
                        case Constants.CREATE_ELEMENT_REPLICA_ASYNC_ACTION:
                            supportedAsyncActionsSet.add(StorageSystem.AsyncActions.CreateElementReplica.name());
                            break;
                        case Constants.CREATE_GROUP_REPLICA_ASYNC_ACTION:
                            supportedAsyncActionsSet.add(StorageSystem.AsyncActions.CreateGroupReplica.name());
                            break;
                        default:
                    }
                }
            }
            device.setSupportedAsynchronousActions(supportedAsyncActionsSet);
            StringSet replicationTypes = new StringSet();
            replicationTypes.add(SupportedReplicationTypes.LOCAL.name());
            device.setSupportedReplicationTypes(replicationTypes);
            _dbClient.persistObject(device);
        }
    } 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 67 with CIMInstance

use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.

the class XIVTCPProtocolEndPointProcessor 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);
        while (it.hasNext()) {
            CIMInstance tcpPointInstance = null;
            StoragePort port = null;
            try {
                tcpPointInstance = it.next();
                String portInstanceID = getObjectPathfromCIMArgument(args).toString();
                port = _dbClient.queryObject(StoragePort.class, (URI) keyMap.get(portInstanceID));
                updateTCPEndPointDetails(port, tcpPointInstance);
            } 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) URI(java.net.URI) CIMInstance(javax.cim.CIMInstance) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 68 with CIMInstance

use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.

the class BlockStatisticsCapabilitiesProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        final Iterator<?> it = (Iterator<?>) resultObj;
        // Only 1 entry per each Array always
        while (it.hasNext()) {
            final CIMInstance queryInstance = (CIMInstance) it.next();
            CIMProperty prop = queryInstance.getProperty(Constants.CLOCK_TICK_INTERVAL);
            keyMap.put(Constants.CLOCK_TICK_INTERVAL, prop.getValue().toString());
        }
    } catch (Exception e) {
        _logger.error("Failed while processing QueryStatistics :", e);
    }
    resultObj = null;
}
Also used : CIMProperty(javax.cim.CIMProperty) Iterator(java.util.Iterator) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 69 with CIMInstance

use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.

the class CapacityPoolProcessor method processVolumeCapacity.

/**
 * Process volume capacity, iterates over the given chunk and process
 * each volume capacity.
 *
 * @param volumeInstances {@link CloseableIterator} instance
 * @param keyMap {@link Map} instance
 */
private void processVolumeCapacity(CloseableIterator<CIMInstance> volumeInstances, Map<String, Object> keyMap) {
    while (volumeInstances.hasNext()) {
        try {
            final CIMInstance volumeInstance = (CIMInstance) volumeInstances.next();
            String key = null;
            String spaceConsumed = null;
            if (keyMap.containsKey(Constants.IS_NEW_SMIS_PROVIDER) && Boolean.valueOf(keyMap.get(Constants.IS_NEW_SMIS_PROVIDER).toString())) {
                key = createKeyfor8x(volumeInstance);
                spaceConsumed = volumeInstance.getProperty(_emcspaceConsumed).getValue().toString();
            } else {
                key = createKeyfromProps(volumeInstance);
                spaceConsumed = volumeInstance.getProperty(_spaceConsumed).getValue().toString();
            }
            Object value = getMetrics(keyMap, key);
            if (null == value) {
                keyMap.put(key, Long.parseLong(spaceConsumed));
            } else if (value instanceof Stat) {
                Stat metrics = (Stat) value;
                metrics.setProvisionedCapacity(returnProvisionedCapacity(volumeInstance, keyMap));
                metrics.setAllocatedCapacity(Long.parseLong(spaceConsumed));
            }
        } catch (Exception ex) {
            // This check will make sure to skip unnecessary logs
            if (!(ex instanceof BaseCollectionException)) {
                _logger.error("Provisioned Capacity failure : ", ex);
            }
        }
    }
}
Also used : Stat(com.emc.storageos.db.client.model.Stat) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 70 with CIMInstance

use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.

the class MetricSequenceProcessor method processResult.

@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        while (it.hasNext()) {
            CIMInstance blockManifestInstance = null;
            try {
                blockManifestInstance = it.next();
                String elementType = getCIMPropertyValue(blockManifestInstance, Constants.ELEMENTTYPE);
                String elementName = getCIMPropertyValue(blockManifestInstance, Constants.ELEMENTNAME);
                String[] csvSeq = (String[]) blockManifestInstance.getPropertyValue(Constants.CSV_SEQUENCE);
                List<String> csvSequenceList = new LinkedList<String>(Arrays.asList(csvSeq));
                _logger.debug("csvSequenceList: {}", csvSequenceList);
                if (elementType.equals(Constants.VOLUME_ELEMENTTYPE) && elementName.equals(Constants.STORAGEOS_VOLUME_MANIFEST)) {
                    keyMap.put(Constants.STORAGEOS_VOLUME_MANIFEST, csvSequenceList);
                } else if (elementType.equals(Constants.FEPORT_ELEMENTTYPE) && elementName.equals(Constants.STORAGEOS_FEPORT_MANIFEST)) {
                    keyMap.put(Constants.STORAGEOS_FEPORT_MANIFEST, csvSequenceList);
                } else if (elementType.equals(Constants.FEADAPT_ELEMENTTYPE) && elementName.equals(Constants.STORAGEOS_FEADAPT_MANIFEST)) {
                    keyMap.put(Constants.STORAGEOS_FEADAPT_MANIFEST, csvSequenceList);
                } else if (elementType.equals(Constants.SYSTEM_ELEMENTTYPE) && elementName.equals(Constants.STORAGEOS_SYSTEM_MANIFEST)) {
                    keyMap.put(Constants.STORAGEOS_SYSTEM_MANIFEST, csvSequenceList);
                }
            } catch (Exception e) {
                _logger.warn("MetricSequence call failed for {}", getCIMPropertyValue(blockManifestInstance, Constants.INSTANCEID), e);
            }
        }
    } catch (Exception e) {
        _logger.error("Processing MetricSequence call failed", e);
    }
}
Also used : Iterator(java.util.Iterator) CIMInstance(javax.cim.CIMInstance) LinkedList(java.util.LinkedList) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Aggregations

CIMInstance (javax.cim.CIMInstance)370 CIMObjectPath (javax.cim.CIMObjectPath)254 WBEMException (javax.wbem.WBEMException)139 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)104 ArrayList (java.util.ArrayList)98 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)79 URI (java.net.URI)79 CIMArgument (javax.cim.CIMArgument)71 WBEMClient (javax.wbem.client.WBEMClient)69 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)62 Volume (com.emc.storageos.db.client.model.Volume)62 HashSet (java.util.HashSet)60 IOException (java.io.IOException)53 HashMap (java.util.HashMap)52 Iterator (java.util.Iterator)50 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)48 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)48 CIMProperty (javax.cim.CIMProperty)37 StringSet (com.emc.storageos.db.client.model.StringSet)31 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)29