use of com.emc.storageos.plugins.BaseCollectionException 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 com.emc.storageos.plugins.BaseCollectionException 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 com.emc.storageos.plugins.BaseCollectionException 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.BaseCollectionException in project coprhd-controller by CoprHD.
the class PersistFASTPolicyProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
_dbClient = (DbClient) keyMap.get(Constants.dbClient);
List<AutoTieringPolicy> fastPolicies = new ArrayList<AutoTieringPolicy>();
@SuppressWarnings("unchecked") Map<String, Set<String>> mapping = (Map<String, Set<String>>) keyMap.get(Constants.POLICY_TO_POOLS_MAPPING);
for (String key : mapping.keySet()) {
AutoTieringPolicy policy = getAutoTieringPolicyByNameFromDB(key, _dbClient);
Set<String> pools = mapping.get(key);
policy.addPools(pools);
fastPolicies.add(policy);
}
_dbClient.persistObject(fastPolicies);
} catch (Exception e) {
_logger.error("Adding Pools to POlicy Objects and Persisting failed :", e);
}
}
use of com.emc.storageos.plugins.BaseCollectionException 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);
}
}
}
Aggregations