use of javax.cim.CIMInstance in project coprhd-controller by CoprHD.
the class ExportProcessor method processResult.
/*
* (non-Javadoc)
*
* @see com.emc.storageos.plugins.common.Processor#processResult(com.emc.storageos.plugins.common.domainmodel.Operation,
* java.lang.Object, java.util.Map)
*/
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
initialize(operation, resultObj, keyMap);
CloseableIterator<CIMInstance> it = null;
EnumerateResponse<CIMInstance> response = null;
List<Initiator> matchedInitiators = new ArrayList<Initiator>();
List<StoragePort> matchedPorts = new ArrayList<StoragePort>();
WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
StringSet knownIniSet = new StringSet();
StringSet knownNetworkIdSet = new StringSet();
StringSet knownPortSet = new StringSet();
StringSet knownVolumeSet = new StringSet();
try {
// set lun masking view CIM path
CIMObjectPath path = this.getObjectPathfromCIMArgument(_args, keyMap);
UnManagedExportMask mask = this.getUnManagedExportMask(path);
mask.setMaskingViewPath(path.toString());
_logger.info("looking at lun masking view: " + path.toString());
CIMInstance lunMaskingView = client.getInstance(path, false, false, null);
if (lunMaskingView != null) {
String maskName = CIMPropertyFactory.getPropertyValue(lunMaskingView, SmisConstants.CP_NAME);
if (maskName != null) {
mask.setMaskName(maskName);
}
_logger.info("set UnManagedExportMask maskName to " + mask.getMaskName());
} else {
_logger.info("lunMaskingView was null");
}
CIMProperty<String> deviceIdProperty = (CIMProperty<String>) path.getKey(SmisConstants.CP_DEVICE_ID);
if (deviceIdProperty != null) {
mask.setNativeId(deviceIdProperty.getValue());
}
_logger.info("set UnManagedExportMask nativeId to " + mask.getNativeId());
// set storage system id
URI systemId = (URI) keyMap.get(Constants.SYSTEMID);
mask.setStorageSystemUri(systemId);
response = (EnumerateResponse<CIMInstance>) resultObj;
processVolumesAndInitiatorsPaths(response.getResponses(), mask, matchedInitiators, matchedPorts, knownIniSet, knownNetworkIdSet, knownPortSet, knownVolumeSet);
while (!response.isEnd()) {
_logger.info("Processing next Chunk");
response = client.getInstancesWithPath(Constants.MASKING_PATH, response.getContext(), new UnsignedInteger32(BATCH_SIZE));
processVolumesAndInitiatorsPaths(response.getResponses(), mask, matchedInitiators, matchedPorts, knownIniSet, knownNetworkIdSet, knownPortSet, knownVolumeSet);
}
// CTRL - 8918 - always update the mask with new initiators and volumes.
mask.replaceNewWithOldResources(knownIniSet, knownNetworkIdSet, knownVolumeSet, knownPortSet);
// get zones and store them?
updateZoningMap(mask, matchedInitiators, matchedPorts);
updateVplexBackendVolumes(mask, matchedInitiators);
updateRecoverPointVolumes(mask, matchedInitiators);
} catch (Exception e) {
_logger.error("something failed", e);
} finally {
if (it != null) {
it.close();
}
wrapUp();
if (response != null) {
try {
client.closeEnumeration(Constants.MASKING_PATH, response.getContext());
} catch (Exception e) {
_logger.debug("Exception occurred while closing enumeration", e);
}
}
}
}
use of javax.cim.CIMInstance 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.CIMInstance 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.CIMInstance 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.CIMInstance 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);
}
}
Aggregations