use of javax.cim.UnsignedInteger32 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.cim.UnsignedInteger32 in project coprhd-controller by CoprHD.
the class StorageVolumeBoundPoolProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
CloseableIterator<CIMInstance> allocatedFromStoragePoolInstances = null;
EnumerateResponse<CIMInstance> allocatedFromStoragePoolInstanceChunks = null;
@SuppressWarnings("unchecked") Map<String, Set<String>> vmax2ThinPoolToBoundVolumesMap = (Map<String, Set<String>>) keyMap.get(Constants.VMAX2_THIN_POOL_TO_BOUND_VOLUMES);
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
CIMObjectPath storagePoolPath = null;
try {
storagePoolPath = getObjectPathfromCIMArgument(_args);
_logger.debug("VMAX2 Thin Pool: {}", storagePoolPath.toString());
String poolNativeGuid = NativeGUIDGenerator.generateNativeGuidForPool(storagePoolPath);
StoragePool pool = checkStoragePoolExistsInDB(poolNativeGuid, _dbClient);
if (pool == null) {
_logger.error("Skipping unmanaged volume discovery as the storage pool with path {} doesn't exist in ViPR", storagePoolPath.toString());
return;
}
Set<String> boundVolumes = new HashSet<String>();
allocatedFromStoragePoolInstanceChunks = (EnumerateResponse<CIMInstance>) resultObj;
allocatedFromStoragePoolInstances = allocatedFromStoragePoolInstanceChunks.getResponses();
processVolumes(allocatedFromStoragePoolInstances, boundVolumes);
while (!allocatedFromStoragePoolInstanceChunks.isEnd()) {
_logger.info("Processing Next Volume Chunk of size {}", BATCH_SIZE);
allocatedFromStoragePoolInstanceChunks = client.getInstancesWithPath(storagePoolPath, allocatedFromStoragePoolInstanceChunks.getContext(), new UnsignedInteger32(BATCH_SIZE));
processVolumes(allocatedFromStoragePoolInstanceChunks.getResponses(), boundVolumes);
}
vmax2ThinPoolToBoundVolumesMap.put(storagePoolPath.toString(), boundVolumes);
_logger.debug("Bound volumes list {}", Joiner.on("\t").join(boundVolumes));
} catch (Exception e) {
_logger.error("Processing Bound Storage Volume Information failed :", e);
} finally {
if (null != allocatedFromStoragePoolInstances) {
allocatedFromStoragePoolInstances.close();
}
if (null != allocatedFromStoragePoolInstanceChunks) {
try {
client.closeEnumeration(storagePoolPath, allocatedFromStoragePoolInstanceChunks.getContext());
} catch (Exception e) {
_logger.debug("Exception occurred while closing enumeration", e);
}
}
}
}
use of javax.cim.UnsignedInteger32 in project coprhd-controller by CoprHD.
the class StorageVolumeInfoProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
CloseableIterator<CIMInstance> volumeInstances = null;
EnumerateResponse<CIMInstance> volumeInstanceChunks = null;
CIMObjectPath storagePoolPath = null;
WBEMClient client = null;
try {
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
client = SMICommunicationInterface.getCIMClient(keyMap);
_profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
Map<String, VolHostIOObject> exportedVolumes = (Map<String, VolHostIOObject>) keyMap.get(Constants.EXPORTED_VOLUMES);
Set<String> existingVolumesInCG = (Set<String>) keyMap.get(Constants.VOLUMES_PART_OF_CG);
@SuppressWarnings("unchecked") Map<String, RemoteMirrorObject> volumeToRAGroupMap = (Map<String, RemoteMirrorObject>) keyMap.get(Constants.UN_VOLUME_RAGROUP_MAP);
@SuppressWarnings("unchecked") Map<String, LocalReplicaObject> volumeToLocalReplicaMap = (Map<String, LocalReplicaObject>) keyMap.get(Constants.UN_VOLUME_LOCAL_REPLICA_MAP);
@SuppressWarnings("unchecked") Map<String, Map<String, String>> volumeToSyncAspectMap = (Map<String, Map<String, String>>) keyMap.get(Constants.SNAPSHOT_NAMES_SYNCHRONIZATION_ASPECT_MAP);
@SuppressWarnings("unchecked") Map<String, Set<String>> duplicateSyncAspectElementNameMap = (Map<String, Set<String>>) keyMap.get(Constants.DUPLICATE_SYNC_ASPECT_ELEMENT_NAME_MAP);
@SuppressWarnings("unchecked") Map<String, Set<String>> vmax2ThinPoolToBoundVolumesMap = (Map<String, Set<String>>) keyMap.get(Constants.VMAX2_THIN_POOL_TO_BOUND_VOLUMES);
Set<String> boundVolumes = null;
storagePoolPath = getObjectPathfromCIMArgument(_args);
String poolNativeGuid = NativeGUIDGenerator.generateNativeGuidForPool(storagePoolPath);
StoragePool pool = checkStoragePoolExistsInDB(poolNativeGuid, _dbClient);
if (pool == null) {
_logger.error("Skipping unmanaged volume discovery as the storage pool with path {} doesn't exist in ViPR", storagePoolPath.toString());
return;
}
StorageSystem system = _dbClient.queryObject(StorageSystem.class, _profile.getSystemId());
_unManagedVolumesInsert = new ArrayList<UnManagedVolume>();
_unManagedVolumesUpdate = new ArrayList<UnManagedVolume>();
_unManagedExportMasksUpdate = new ArrayList<UnManagedExportMask>();
// get bound volumes list for VMAX2 Thin pools
boundVolumes = vmax2ThinPoolToBoundVolumesMap.get(storagePoolPath.toString());
Set<String> poolSupportedSLONames = (Set<String>) keyMap.get(poolNativeGuid);
_logger.debug("Pool Supporting SLO Names:{}", poolSupportedSLONames);
_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)
_metaVolumePaths = (List<CIMObjectPath>) keyMap.get(Constants.META_VOLUMES);
if (_metaVolumePaths == null) {
_metaVolumePaths = new ArrayList<CIMObjectPath>();
keyMap.put(Constants.META_VOLUMES, _metaVolumePaths);
}
_volumeToSpaceConsumedMap = (Map<String, String>) keyMap.get(Constants.VOLUME_SPACE_CONSUMED_MAP);
// get VolumeInfo Object and inject Fast Policy Name.
volumeInstanceChunks = (EnumerateResponse<CIMInstance>) resultObj;
volumeInstances = volumeInstanceChunks.getResponses();
Set<URI> srdfEnabledTargetVPools = SRDFUtils.fetchSRDFTargetVirtualPools(_dbClient);
processVolumes(volumeInstances, keyMap, operation, pool, system, exportedVolumes, existingVolumesInCG, volumeToRAGroupMap, volumeToLocalReplicaMap, volumeToSyncAspectMap, poolSupportedSLONames, boundVolumes, srdfEnabledTargetVPools, duplicateSyncAspectElementNameMap);
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, operation, pool, system, exportedVolumes, existingVolumesInCG, volumeToRAGroupMap, volumeToLocalReplicaMap, volumeToSyncAspectMap, poolSupportedSLONames, boundVolumes, srdfEnabledTargetVPools, duplicateSyncAspectElementNameMap);
}
if (null != _unManagedVolumesUpdate && !_unManagedVolumesUpdate.isEmpty()) {
_partitionManager.updateAndReIndexInBatches(_unManagedVolumesUpdate, getPartitionSize(keyMap), _dbClient, UNMANAGED_VOLUME);
}
if (null != _unManagedVolumesInsert && !_unManagedVolumesInsert.isEmpty()) {
_partitionManager.insertInBatches(_unManagedVolumesInsert, getPartitionSize(keyMap), _dbClient, UNMANAGED_VOLUME);
}
if (null != _unManagedExportMasksUpdate && !_unManagedExportMasksUpdate.isEmpty()) {
_partitionManager.updateAndReIndexInBatches(_unManagedExportMasksUpdate, getPartitionSize(keyMap), _dbClient, UNMANAGED_EXPORT_MASK);
}
performStorageUnManagedVolumeBookKeeping(pool.getId());
} catch (Exception e) {
_logger.error("Processing Storage Volume Information failed :", e);
} finally {
_unManagedVolumesInsert = null;
_unManagedVolumesUpdate = null;
if (null != volumeInstances) {
volumeInstances.close();
}
if (null != volumeInstanceChunks) {
try {
client.closeEnumeration(storagePoolPath, volumeInstanceChunks.getContext());
} catch (Exception e) {
_logger.debug("Exception occurred while closing enumeration", e);
}
}
}
}
use of javax.cim.UnsignedInteger32 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.cim.UnsignedInteger32 in project coprhd-controller by CoprHD.
the class AbstractMirrorOperations method detachSingleVolumeMirror.
@Override
public void detachSingleVolumeMirror(StorageSystem storage, URI mirror, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("detachSingleVolumeMirror operation START");
try {
BlockMirror mirrorObj = _dbClient.queryObject(BlockMirror.class, mirror);
CIMArgument[] inArgs = _helper.getDetachSynchronizationInputArguments(storage, mirrorObj);
CIMArgument[] outArgs = new CIMArgument[5];
// Invoke method to detach the local mirror
UnsignedInteger32 result = (UnsignedInteger32) _helper.callModifyReplica(storage, inArgs, outArgs);
if (JOB_COMPLETED_NO_ERROR.equals(result)) {
taskCompleter.ready(_dbClient);
} else {
String msg = String.format("SMI-S call returned unsuccessfully: %s", result);
taskCompleter.error(_dbClient, DeviceControllerException.errors.smis.jobFailed(msg));
}
} catch (Exception e) {
_log.error("Problem making SMI-S call: ", e);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
taskCompleter.error(_dbClient, serviceError);
}
}
Aggregations