use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class ControllerConfigurationProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
@SuppressWarnings("unchecked") final Iterator<CIMObjectPath> it = (Iterator<CIMObjectPath>) resultObj;
while (it.hasNext()) {
CIMObjectPath controllerConfigurationService = it.next();
String systemName = controllerConfigurationService.getKey(Constants.SYSTEMNAME).getValue().toString();
String serialID = (String) keyMap.get(Constants._serialID);
if (systemName.contains(serialID)) {
addPath(keyMap, operation.getResult(), controllerConfigurationService);
if (systemName.toLowerCase().contains(Constants.SYMMETRIX)) {
keyMap.put(Constants.VMAXConfigurationService, controllerConfigurationService);
} else if (systemName.toLowerCase().contains(Constants.CLARIION)) {
keyMap.put(Constants.VNXConfigurationService, controllerConfigurationService);
}
}
}
} catch (Exception e) {
_logger.error("Controller Configuration Service Discovery Failed : ", e);
}
}
use of javax.cim.CIMObjectPath 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 javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class TierPercentageProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
while (it.hasNext()) {
try {
CIMInstance symmAssociatedPolicyInstance = it.next();
CIMObjectPath symmAssociatedPolicyPath = symmAssociatedPolicyInstance.getObjectPath();
CIMObjectPath tierPath = (CIMObjectPath) symmAssociatedPolicyPath.getKey(DEPENDENT).getValue();
String tierPercent = symmAssociatedPolicyInstance.getPropertyValue(MAX_PERCENT_ALLOCATED).toString();
String tierID = tierPath.getKey(Constants.INSTANCEID).getValue().toString();
String tierNativeGuid = getTierNativeGuidForVMax(tierID);
StorageTier tierObject = checkStorageTierExistsInDB(tierNativeGuid, _dbClient);
if (null != tierObject) {
tierObject.setPercentage(tierPercent);
_dbClient.persistObject(tierObject);
}
} catch (Exception e) {
_logger.error("Vmax Tier Percentage Discovery failed", e);
}
}
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class VMAXPolicyToTierProcessor 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);
_updateTierList = new ArrayList<StorageTier>();
_newTierList = new ArrayList<StorageTier>();
// value will be set already always
Object[] arguments = (Object[]) _args.get(0);
Set<String> tierNativeGuidsfromProvider = new HashSet<String>();
CIMObjectPath vmaxFastPolicyRule = (CIMObjectPath) arguments[0];
String vmaxPolicyId = getFASTPolicyID(vmaxFastPolicyRule);
AutoTieringPolicy vmaxFastPolicy = getAutoTieringPolicyByNameFromDB(vmaxPolicyId, _dbClient);
// the relationship between Policy--->Pools
while (it.hasNext()) {
CIMInstance vmaxTierInstance = it.next();
CIMObjectPath tierPath = vmaxTierInstance.getObjectPath();
String tierID = tierPath.getKey(Constants.INSTANCEID).getValue().toString();
// For 8.x -+- becomes +, internal DB format uses + only; for 4.6 remains as it is
tierID = tierID.replaceAll(Constants.SMIS_80_STYLE, Constants.SMIS_PLUS_REGEX);
if (keyMap.containsKey(tierID)) {
List<CIMObjectPath> policyPaths = (List<CIMObjectPath>) keyMap.get(tierID);
policyPaths.add(vmaxFastPolicyRule);
} else {
addPath(keyMap, Constants.STORAGETIERS, tierPath);
List<CIMObjectPath> policyPaths = new ArrayList<CIMObjectPath>();
policyPaths.add(vmaxFastPolicyRule);
keyMap.put(tierID, policyPaths);
}
String tierNativeGuid = getTierNativeGuidForVMax(tierID);
tierNativeGuidsfromProvider.add(tierNativeGuid);
StorageTier tierObject = checkStorageTierExistsInDB(tierNativeGuid, _dbClient);
String driveTechnologyIdentifier = vmaxTierInstance.getPropertyValue(Constants.TECHNOLOGY).toString();
String driveType = StorageTier.SupportedTiers.getTier(driveTechnologyIdentifier);
createStorageTier(vmaxTierInstance, tierObject, tierNativeGuid, vmaxFastPolicy.getId(), _newTierList, _updateTierList, driveType);
}
_dbClient.createObject(_newTierList);
_dbClient.persistObject(_updateTierList);
performStorageTierBookKeeping(tierNativeGuidsfromProvider, vmaxFastPolicy.getId());
} catch (Exception e) {
_logger.error("Policy to Tier Processing failed :", e);
}
}
use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.
the class VMAXTiersToPoolProcessor method addFastPolicyToTier.
@SuppressWarnings("unchecked")
private void addFastPolicyToTier(List<CIMObjectPath> policyPaths, String tierID) throws IOException {
Set<String> policyUris = new StringSet();
// getting policy uris from DB
for (CIMObjectPath path : policyPaths) {
String policyID = getFASTPolicyID(path);
AutoTieringPolicy policy = getAutoTieringPolicyByNameFromDB(policyID, _dbClient);
if (null != policy) {
policyUris.add(policy.getId().toString());
}
}
StorageTier tierObject = checkStorageTierExistsInDB(getTierNativeGuidForVMax(tierID), _dbClient);
if (null != tierObject) {
if (null == tierObject.getAutoTieringPolicies()) {
tierObject.setAutoTieringPolicies(new StringSet());
}
tierObject.getAutoTieringPolicies().replace(policyUris);
_dbClient.updateAndReindexObject(tierObject);
}
}
Aggregations