Search in sources :

Example 71 with CIMObjectPath

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);
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) Iterator(java.util.Iterator) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 72 with CIMObjectPath

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);
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) AccessProfile(com.emc.storageos.plugins.AccessProfile) URI(java.net.URI) CIMInstance(javax.cim.CIMInstance) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) Iterator(java.util.Iterator) HashSet(java.util.HashSet)

Example 73 with CIMObjectPath

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);
        }
    }
}
Also used : Iterator(java.util.Iterator) CIMObjectPath(javax.cim.CIMObjectPath) StorageTier(com.emc.storageos.db.client.model.StorageTier) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 74 with CIMObjectPath

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);
    }
}
Also used : StorageTier(com.emc.storageos.db.client.model.StorageTier) CIMObjectPath(javax.cim.CIMObjectPath) ArrayList(java.util.ArrayList) CIMInstance(javax.cim.CIMInstance) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) HashSet(java.util.HashSet)

Example 75 with CIMObjectPath

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);
    }
}
Also used : AutoTieringPolicy(com.emc.storageos.db.client.model.AutoTieringPolicy) StringSet(com.emc.storageos.db.client.model.StringSet) CIMObjectPath(javax.cim.CIMObjectPath) StorageTier(com.emc.storageos.db.client.model.StorageTier)

Aggregations

CIMObjectPath (javax.cim.CIMObjectPath)582 CIMInstance (javax.cim.CIMInstance)254 WBEMException (javax.wbem.WBEMException)236 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)208 CIMArgument (javax.cim.CIMArgument)190 ArrayList (java.util.ArrayList)139 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)118 Volume (com.emc.storageos.db.client.model.Volume)108 URI (java.net.URI)108 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)82 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)76 WBEMClient (javax.wbem.client.WBEMClient)75 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)72 HashSet (java.util.HashSet)68 HashMap (java.util.HashMap)63 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)57 CIMProperty (javax.cim.CIMProperty)57 IOException (java.io.IOException)55 BlockObject (com.emc.storageos.db.client.model.BlockObject)52 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)52