Search in sources :

Example 26 with BaseCollectionException

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

the class VNXUnityCommunicationInterface method computeStaticLoadMetrics.

/**
 * Compute static load metrics.
 *
 * @param accessProfile
 * @return
 */
private void computeStaticLoadMetrics(AccessProfile accessProfile) throws BaseCollectionException {
    URI storageSystemId = accessProfile.getSystemId();
    StorageSystem storageSystem = null;
    try {
        storageSystem = _dbClient.queryObject(StorageSystem.class, storageSystemId);
        _logger.info("started computeStaticLoadMetrics for storagesystem: {}", storageSystem.getLabel());
        VNXeApiClient client = getVnxUnityClient(accessProfile);
        List<VNXeNasServer> nasServers = client.getNasServers();
        for (VNXeNasServer nasServer : nasServers) {
            if ((nasServer.getMode() == VNXeNasServer.NasServerModeEnum.DESTINATION) || nasServer.getIsReplicationDestination()) {
                _logger.debug("Found a replication destination NasServer");
                continue;
            }
            if (nasServer.getIsSystem()) {
                // skip system nasServer
                continue;
            }
            VirtualNAS virtualNAS = findvNasByNativeId(storageSystem, nasServer.getId());
            if (virtualNAS != null) {
                _logger.info("Process db metrics for nas server : {}", nasServer.getName());
                StringMap dbMetrics = virtualNAS.getMetrics();
                if (dbMetrics == null) {
                    dbMetrics = new StringMap();
                }
                // process db metrics
                StringMap tmpDbMetrics = populateDbMetrics(nasServer, client);
                dbMetrics.putAll(tmpDbMetrics);
                // set dbMetrics in db
                virtualNAS.setMetrics(dbMetrics);
                _dbClient.updateObject(virtualNAS);
            }
        }
    } catch (Exception e) {
        _logger.error("CollectStatisticsInformation failed. Storage system: {}", storageSystemId, e);
    }
}
Also used : StringMap(com.emc.storageos.db.client.model.StringMap) VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS) VNXeApiClient(com.emc.storageos.vnxe.VNXeApiClient) VNXeNasServer(com.emc.storageos.vnxe.models.VNXeNasServer) URI(java.net.URI) VNXeException(com.emc.storageos.vnxe.VNXeException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) VNXeStorageSystem(com.emc.storageos.vnxe.models.VNXeStorageSystem)

Example 27 with BaseCollectionException

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

the class StorageVolumeProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    EnumerateResponse<CIMInstance> volumeInstanceChunks = (EnumerateResponse<CIMInstance>) resultObj;
    _dbClient = (DbClient) keyMap.get(Constants.dbClient);
    _keyMap = keyMap;
    _updateVolumes = new ArrayList<Volume>();
    _updateSnapShots = new ArrayList<BlockSnapshot>();
    _updateMirrors = new ArrayList<BlockMirror>();
    CloseableIterator<CIMInstance> volumeInstances = null;
    try {
        // create empty place holder list for meta volume paths (cannot define this in xml)
        _metaVolumePaths = (List<CIMObjectPath>) keyMap.get(Constants.META_VOLUMES);
        if (_metaVolumePaths == null) {
            keyMap.put(Constants.META_VOLUMES, new ArrayList<CIMObjectPath>());
        }
        _volumeToSpaceConsumedMap = (Map<String, String>) keyMap.get(Constants.VOLUME_SPACE_CONSUMED_MAP);
        CIMObjectPath storagePoolPath = getObjectPathfromCIMArgument(_args);
        _isVMAX3 = storagePoolPath.getObjectName().equals(StoragePool.PoolClassNames.Symm_SRPStoragePool.name());
        processResultbyChunk(resultObj, keyMap);
        _partitionManager.updateInBatches(_updateVolumes, getPartitionSize(keyMap), _dbClient, VOLUME);
        _partitionManager.updateInBatches(_updateSnapShots, getPartitionSize(keyMap), _dbClient, BLOCK_SNAPSHOT);
        _partitionManager.updateInBatches(_updateMirrors, getPartitionSize(keyMap), _dbClient, BLOCK_MIRROR);
    } catch (Exception e) {
        _logger.error("Processing Volumes and Snapshots failed", e);
    } finally {
        _updateVolumes = null;
        _updateSnapShots = null;
        _updateMirrors = null;
        if (null != volumeInstances) {
            volumeInstances.close();
        }
    }
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) CIMObjectPath(javax.cim.CIMObjectPath) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Volume(com.emc.storageos.db.client.model.Volume) EnumerateResponse(javax.wbem.client.EnumerateResponse)

Example 28 with BaseCollectionException

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

the class StorageVolumeViewProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    EnumerateResponse<CIMInstance> volumeInstanceChunks = (EnumerateResponse<CIMInstance>) resultObj;
    WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
    _dbClient = (DbClient) keyMap.get(Constants.dbClient);
    _updateVolumes = new ArrayList<Volume>();
    _updateSnapShots = new ArrayList<BlockSnapshot>();
    _updateMirrors = new ArrayList<BlockMirror>();
    CloseableIterator<CIMInstance> volumeInstances = null;
    try {
        _metaVolumeViewPaths = (List<CIMObjectPath>) keyMap.get(Constants.META_VOLUMES_VIEWS);
        if (_metaVolumeViewPaths == null) {
            _metaVolumeViewPaths = new ArrayList<CIMObjectPath>();
            keyMap.put(Constants.META_VOLUMES_VIEWS, _metaVolumeViewPaths);
        }
        // create empty place holder list for meta volume paths (cannot define this in xml)
        List<CIMObjectPath> metaVolumePaths = (List<CIMObjectPath>) keyMap.get(Constants.META_VOLUMES);
        if (metaVolumePaths == null) {
            keyMap.put(Constants.META_VOLUMES, new ArrayList<CIMObjectPath>());
        }
        CIMObjectPath storagePoolPath = getObjectPathfromCIMArgument(_args);
        volumeInstances = volumeInstanceChunks.getResponses();
        processVolumes(volumeInstances, keyMap);
        while (!volumeInstanceChunks.isEnd()) {
            _logger.info("Processing Next Volume Chunk of size {}", BATCH_SIZE);
            volumeInstanceChunks = client.getInstancesWithPath(storagePoolPath, volumeInstanceChunks.getContext(), new UnsignedInteger32(BATCH_SIZE));
            processVolumes(volumeInstanceChunks.getResponses(), keyMap);
        }
        // if list empty, this method returns back immediately.
        // partition size might not be used in this context, as batch size < partition size.
        // TODO metering might need some extra work to push volumes in batches, hence not changing this method
        // signature
        _partitionManager.updateInBatches(_updateVolumes, getPartitionSize(keyMap), _dbClient, VOLUME);
        _partitionManager.updateInBatches(_updateSnapShots, getPartitionSize(keyMap), _dbClient, BLOCK_SNAPSHOT);
        _partitionManager.updateInBatches(_updateMirrors, getPartitionSize(keyMap), _dbClient, BLOCK_MIRROR);
    } catch (Exception e) {
        _logger.error("Processing Volumes and Snapshots failed", e);
    } finally {
        _updateVolumes = null;
        _updateSnapShots = null;
        _updateMirrors = null;
        if (null != volumeInstances) {
            volumeInstances.close();
        }
    }
}
Also used : BlockMirror(com.emc.storageos.db.client.model.BlockMirror) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) CIMObjectPath(javax.cim.CIMObjectPath) UnsignedInteger32(javax.cim.UnsignedInteger32) CIMInstance(javax.cim.CIMInstance) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Volume(com.emc.storageos.db.client.model.Volume) ArrayList(java.util.ArrayList) List(java.util.List) WBEMClient(javax.wbem.client.WBEMClient) EnumerateResponse(javax.wbem.client.EnumerateResponse)

Example 29 with BaseCollectionException

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

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

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