Search in sources :

Example 1 with EnumerateResponse

use of javax.wbem.client.EnumerateResponse 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 2 with EnumerateResponse

use of javax.wbem.client.EnumerateResponse 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 3 with EnumerateResponse

use of javax.wbem.client.EnumerateResponse in project coprhd-controller by CoprHD.

the class SGsWithFastVolumesProcessor method processResult.

/**
 * This processor gets invoked only for VMAX unManaged volume discoveries.
 * Volumes belonging to SG are processed , and using the mapping information Storage Groups-->Fast Policy,
 * we identify the volume's policy.
 */
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    CloseableIterator<CIMObjectPath> volumeInstances = null;
    try {
        @SuppressWarnings("unchecked") Map<String, String> policyToStorageGroupMapping = (Map<String, String>) keyMap.get(Constants.POLICY_STORAGE_GROUP_MAPPING);
        CIMObjectPath storageGroupPath = getObjectPathfromCIMArgument(_args);
        String groupId = storageGroupPath.getKey(Constants.INSTANCEID).getValue().toString();
        String policyName = policyToStorageGroupMapping.get(groupId);
        _logger.info("Group {}  policy Name {}", groupId, policyName);
        if (null == policyName) {
            return;
        }
        WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
        _unManagedVolumesUpdate = new ArrayList<UnManagedVolume>();
        @SuppressWarnings("unchecked") EnumerateResponse<CIMObjectPath> volumeInstanceChunks = (EnumerateResponse<CIMObjectPath>) resultObj;
        volumeInstances = volumeInstanceChunks.getResponses();
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        processVolumes(volumeInstances, policyName, keyMap, operation);
        while (!volumeInstanceChunks.isEnd()) {
            _logger.debug("Processing Next Volume Chunk of size {}", BATCH_SIZE);
            volumeInstanceChunks = client.getInstancePaths(storageGroupPath, volumeInstanceChunks.getContext(), new UnsignedInteger32(BATCH_SIZE));
            processVolumes(volumeInstanceChunks.getResponses(), policyName, keyMap, operation);
        }
        if (!_unManagedVolumesUpdate.isEmpty()) {
            _partitionManager.updateInBatches(_unManagedVolumesUpdate, getPartitionSize(keyMap), _dbClient, "VOLUME");
            _unManagedVolumesUpdate.clear();
        }
    } catch (Exception e) {
        _logger.error("Discovering Tier Policies for vmax volumes failed", e);
    } finally {
        if (volumeInstances != null) {
            volumeInstances.close();
        }
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) UnsignedInteger32(javax.cim.UnsignedInteger32) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) WBEMClient(javax.wbem.client.WBEMClient) Map(java.util.Map) EnumerateResponse(javax.wbem.client.EnumerateResponse)

Example 4 with EnumerateResponse

use of javax.wbem.client.EnumerateResponse in project coprhd-controller by CoprHD.

the class VNXFastVolumesProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    CloseableIterator<CIMObjectPath> volumeInstances = null;
    try {
        WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
        _unManagedVolumesUpdate = new ArrayList<UnManagedVolume>();
        @SuppressWarnings("unchecked") EnumerateResponse<CIMObjectPath> volumeInstanceChunks = (EnumerateResponse<CIMObjectPath>) resultObj;
        volumeInstances = volumeInstanceChunks.getResponses();
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        CIMObjectPath tierPolicypath = getObjectPathfromCIMArgument(_args);
        processVolumes(volumeInstances, tierPolicypath, keyMap, operation);
        while (!volumeInstanceChunks.isEnd()) {
            _logger.info("Processing Next Volume Chunk of size {}", BATCH_SIZE);
            volumeInstanceChunks = client.getInstancePaths(tierPolicypath, volumeInstanceChunks.getContext(), new UnsignedInteger32(BATCH_SIZE));
            processVolumes(volumeInstanceChunks.getResponses(), tierPolicypath, keyMap, operation);
        }
        if (!_unManagedVolumesUpdate.isEmpty()) {
            _partitionManager.updateInBatches(_unManagedVolumesUpdate, getPartitionSize(keyMap), _dbClient, "VOLUME");
            _unManagedVolumesUpdate.clear();
        }
    } catch (Exception e) {
        _logger.error("Discovering Tier Policies for vnx volumes failed", e);
    } finally {
        volumeInstances.close();
    }
}
Also used : UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) CIMObjectPath(javax.cim.CIMObjectPath) UnsignedInteger32(javax.cim.UnsignedInteger32) WBEMClient(javax.wbem.client.WBEMClient) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) EnumerateResponse(javax.wbem.client.EnumerateResponse)

Example 5 with EnumerateResponse

use of javax.wbem.client.EnumerateResponse in project coprhd-controller by CoprHD.

the class VolumeAccessStateProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    CloseableIterator<CIMInstance> volumeInstances = null;
    try {
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
        _unManagedVolumesUpdate = new ArrayList<UnManagedVolume>();
        CIMObjectPath storagePoolPath = getObjectPathfromCIMArgument(_args);
        String poolNativeGuid = NativeGUIDGenerator.generateNativeGuidForPool(storagePoolPath);
        StoragePool pool = checkStoragePoolExistsInDB(poolNativeGuid, _dbClient);
        if (pool == null) {
            _logger.error("Skipping unmanaged volume discovery of Access Sattes as the storage pool with path {} doesn't exist in ViPR", storagePoolPath.toString());
            return;
        }
        EnumerateResponse<CIMInstance> volumeInstanceChunks = (EnumerateResponse<CIMInstance>) resultObj;
        volumeInstances = volumeInstanceChunks.getResponses();
        processVolumes(volumeInstances, keyMap, operation);
        while (!volumeInstanceChunks.isEnd()) {
            _logger.debug("Processing Next Volume Chunk of size {}", BATCH_SIZE);
            volumeInstanceChunks = client.getInstancesWithPath(storagePoolPath, volumeInstanceChunks.getContext(), new UnsignedInteger32(BATCH_SIZE));
            processVolumes(volumeInstanceChunks.getResponses(), keyMap, operation);
        }
        if (null != _unManagedVolumesUpdate && !_unManagedVolumesUpdate.isEmpty()) {
            _partitionManager.updateInBatches(_unManagedVolumesUpdate, getPartitionSize(keyMap), _dbClient, "UnManagedVolume");
        }
    } catch (Exception e) {
        _logger.error("Discovering Access States of unManaged Volumes failed", e);
    } finally {
        volumeInstances.close();
    }
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) CIMObjectPath(javax.cim.CIMObjectPath) UnsignedInteger32(javax.cim.UnsignedInteger32) WBEMClient(javax.wbem.client.WBEMClient) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) EnumerateResponse(javax.wbem.client.EnumerateResponse)

Aggregations

BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)6 CIMObjectPath (javax.cim.CIMObjectPath)6 EnumerateResponse (javax.wbem.client.EnumerateResponse)6 UnsignedInteger32 (javax.cim.UnsignedInteger32)5 WBEMClient (javax.wbem.client.WBEMClient)5 CIMInstance (javax.cim.CIMInstance)4 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)3 BlockMirror (com.emc.storageos.db.client.model.BlockMirror)2 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)2 Volume (com.emc.storageos.db.client.model.Volume)2 StoragePool (com.emc.storageos.db.client.model.StoragePool)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1