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();
}
}
}
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();
}
}
}
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();
}
}
}
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();
}
}
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();
}
}
Aggregations