use of com.emc.storageos.plugins.AccessProfile in project coprhd-controller by CoprHD.
the class StorageGroupProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
@SuppressWarnings("unchecked") final Iterator<CIMObjectPath> it = (Iterator<CIMObjectPath>) resultObj;
WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
Map<String, String> volumesWithSLO = null;
dbClient = (DbClient) keyMap.get(Constants.dbClient);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
URI systemId = profile.getSystemId();
List<CIMObjectPath> processedSGs = new ArrayList<>();
if (!keyMap.containsKey(Constants.VOLUMES_WITH_SLOS)) {
volumesWithSLO = new HashMap<>();
keyMap.put(Constants.VOLUMES_WITH_SLOS, volumesWithSLO);
} else {
volumesWithSLO = (Map<String, String>) keyMap.get(Constants.VOLUMES_WITH_SLOS);
}
try {
StorageSystem device = dbClient.queryObject(StorageSystem.class, systemId);
// Process these only for VMAX3 Systems.
if (device.checkIfVmax3()) {
if (keyMap.containsKey(Constants.STORAGE_GROUPS_PROCESSED)) {
processedSGs = (List<CIMObjectPath>) keyMap.get(Constants.STORAGE_GROUPS_PROCESSED);
}
while (it.hasNext()) {
CIMObjectPath path = it.next();
if (null != processedSGs && processedSGs.contains(path)) {
logger.info("Skipping the already processed SG. {}", path);
continue;
}
findVolumesSLOFromSGInstance(client, path, volumesWithSLO);
}
}
} catch (Exception e) {
logger.error("Extracting storageGroup details failed.", e);
} finally {
// clean all the processedSGs here.
processedSGs.clear();
}
}
use of com.emc.storageos.plugins.AccessProfile in project coprhd-controller by CoprHD.
the class VNXFastVolumesProcessor method processVolumes.
private void processVolumes(Iterator<CIMObjectPath> it, CIMObjectPath tierPolicyPath, Map<String, Object> keyMap, Operation operation) {
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
StorageSystem system = _dbClient.queryObject(StorageSystem.class, profile.getSystemId());
while (it.hasNext()) {
CIMObjectPath volumePath = null;
try {
volumePath = it.next();
if (tierPolicyPath.toString().contains(AutoTieringPolicy.VnxFastPolicy.DEFAULT_AUTOTIER.toString())) {
_logger.debug("Adding Auto Tier Policy Rule ");
addPath(keyMap, operation.getResult(), volumePath);
continue;
}
String volumeNativeGuid = getVolumeNativeGuid(volumePath);
Volume volume = checkStorageVolumeExistsInDB(volumeNativeGuid, _dbClient);
if (null != volume) {
_logger.debug("Skipping discovery, as this Volume {} is already being managed by ViPR.", volumeNativeGuid);
continue;
}
String unManagedVolumeNativeGuid = getUnManagedVolumeNativeGuidFromVolumePath(volumePath);
UnManagedVolume unManagedVolume = checkUnManagedVolumeExistsInDB(unManagedVolumeNativeGuid, _dbClient);
if (null != unManagedVolume) {
String policyName = getCIMPropertyValue(tierPolicyPath, Constants.POLICYRULENAME);
_logger.info("Adding {} Policy Rule to UnManaged Volume {}", policyName, unManagedVolumeNativeGuid);
injectIntoVolumeInformationContainer(unManagedVolume, Constants.POLICYRULENAME, tierPolicyPath);
unManagedVolume.putVolumeCharacterstics(SupportedVolumeCharacterstics.IS_AUTO_TIERING_ENABLED.toString(), "true");
// StorageVolumeInfoProcessor updated supported_vpool_list based on its pool's presence in vPool
// Now, filter those vPools based on policy associated
DiscoveryUtils.filterSupportedVpoolsBasedOnTieringPolicy(unManagedVolume, policyName, system, _dbClient);
_unManagedVolumesUpdate.add(unManagedVolume);
}
if (_unManagedVolumesUpdate.size() > BATCH_SIZE) {
_partitionManager.updateInBatches(_unManagedVolumesUpdate, getPartitionSize(keyMap), _dbClient, "VOLUME");
_unManagedVolumesUpdate.clear();
}
} catch (Exception ex) {
_logger.error("Processing UnManaged Storage Volume {} ", volumePath, ex);
}
}
}
use of com.emc.storageos.plugins.AccessProfile in project coprhd-controller by CoprHD.
the class FASTPolicyProcessor 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;
_newFastPolicies = new ArrayList<AutoTieringPolicy>();
_updateFastPolicies = new ArrayList<AutoTieringPolicy>();
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
URI storageSystemURI = profile.getSystemId();
Set<String> policyNames = new HashSet<String>();
boolean vnxStartHighThenAutoTierPolicyCreated = false;
while (it.hasNext()) {
CIMInstance policyObjectInstance = it.next();
CIMObjectPath policyObjectPath = policyObjectInstance.getObjectPath();
String systemName = policyObjectPath.getKey(Constants.SYSTEMNAME).getValue().toString();
if (!systemName.contains((String) keyMap.get(Constants._serialID))) {
continue;
}
String[] array = systemName.split(Constants.PATH_DELIMITER_REGEX);
String policyID = getFASTPolicyID(policyObjectPath);
// Trim the policyID from "-+-" to "+" if necessary
Boolean usingSMIS80 = (Boolean) keyMap.get(Constants.USING_SMIS80_DELIMITERS);
if ((null != usingSMIS80) && (true == usingSMIS80)) {
policyID = policyID.replaceAll(Constants.SMIS_80_STYLE, Constants.SMIS_PLUS_REGEX);
}
AutoTieringPolicy policy = getAutoTieringPolicyByNameFromDB(policyID, _dbClient);
String policyRuleName = policyObjectPath.getKey(Constants.POLICYRULENAME).getValue().toString();
policyNames.add(policyRuleName);
String policyEnabled = policyObjectInstance.getPropertyValue(Constants.ENABLED).toString();
String provisioningType = AutoTieringPolicy.ProvisioningType.getType(policyObjectInstance.getPropertyValue(Constants.PROVISIONING_TYPE).toString());
/**
* Only user Defined Policies are considered for VMAX
* For VNX, only default policies are present, there is no concept of userDefined
*/
if (!Constants.SYMMETRIX.equalsIgnoreCase(array[0]) && !Constants.CLARIION.equalsIgnoreCase(array[0])) {
_logger.info("Unsupported FAST Policy :{}", policyID);
return;
}
String fastPolicyServiceConstant = getFASTPolicyServiceConstant(array[0], policyRuleName);
if (null != fastPolicyServiceConstant) {
createFASTPolicy(policyID, policy, policyRuleName, storageSystemURI, policyEnabled, provisioningType);
addPath(keyMap, fastPolicyServiceConstant, policyObjectPath);
keyMap.put(policyRuleName, policyObjectPath);
if (fastPolicyServiceConstant.equals(Constants.VMAXFASTPOLICIES)) {
addDeviceGroupNamesToSetUsedInVerifyingExistence(policyRuleName, keyMap, provisioningType);
addDeviceGroupNamesToSetUsedInVerifyingFASTPolicyRelationShipExistence(policyRuleName, keyMap, provisioningType);
} else if (fastPolicyServiceConstant.equals(Constants.VNXFASTPOLICIES) && !vnxStartHighThenAutoTierPolicyCreated) {
/**
* NOTE: start_high_then_auto_tier policy will not be discovered, thus must
* create it for VNX in ViPR if not created already.
*/
String startHighThenAutoTierPolicyName = Constants.START_HIGH_THEN_AUTO_TIER_POLICY_NAME;
policyNames.add(startHighThenAutoTierPolicyName);
String startHighThenAutTierPolicyId = getFASTPolicyID(systemName, startHighThenAutoTierPolicyName);
AutoTieringPolicy startHighThenAutTierPolicy = getAutoTieringPolicyByNameFromDB(startHighThenAutTierPolicyId, _dbClient);
createFASTPolicy(startHighThenAutTierPolicyId, startHighThenAutTierPolicy, startHighThenAutoTierPolicyName, storageSystemURI, "1", AutoTieringPolicy.ProvisioningType.All.name());
vnxStartHighThenAutoTierPolicyCreated = true;
}
}
}
_dbClient.createObject(_newFastPolicies);
_dbClient.persistObject(_updateFastPolicies);
performPolicyBookKeeping(policyNames, storageSystemURI);
} catch (Exception e) {
_logger.error("FAST Policy Processing failed", e);
}
}
use of com.emc.storageos.plugins.AccessProfile in project coprhd-controller by CoprHD.
the class CommitedSettingsInstanceProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
CIMInstance modifiedInstance = getObjectPathfromCIMArgument();
DbClient _dbClient = (DbClient) keyMap.get(Constants.dbClient);
AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
CIMObjectPath poolSettingPath = modifiedInstance.getObjectPath();
String poolSettingId = poolSettingPath.getKey(Constants.INSTANCEID).getValue().toString();
CIMObjectPath poolCapabilities_Associated_With_Setting = CimObjectPathCreator.createInstance(keyMap.get(poolSettingPath.toString()).toString());
String poolID = getNativeIDFromInstance(poolCapabilities_Associated_With_Setting.getKey(Constants.INSTANCEID).getValue().toString());
StorageSystem device = getStorageSystem(_dbClient, profile.getSystemId());
StoragePool pool = checkStoragePoolExistsInDB(poolID, _dbClient, device);
int tierMethodologyUsedForThisCreatedSetting = Integer.parseInt((String) keyMap.get(poolSettingPath.toString() + Constants.HYPHEN + Constants.TIERMETHODOLOGY));
if (null != pool) {
updatePoolSettingId(tierMethodologyUsedForThisCreatedSetting, pool, poolSettingId);
_dbClient.persistObject(pool);
}
} catch (Exception e) {
_logger.error("Commiting Modified Settign Instance failed", e);
}
}
use of com.emc.storageos.plugins.AccessProfile 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);
}
}
Aggregations