Search in sources :

Example 56 with BaseCollectionException

use of com.emc.storageos.plugins.BaseCollectionException 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 57 with BaseCollectionException

use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.

the class VMAXTiersToPoolProcessor method processResult.

/**
 * {@inheritDoc}
 */
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        @SuppressWarnings("unchecked") final Iterator<CIMObjectPath> it = (Iterator<CIMObjectPath>) resultObj;
        // value set at runtime already
        Object[] arguments = (Object[]) _args.get(0);
        CIMObjectPath tierPath = (CIMObjectPath) arguments[0];
        String tierID = (String) tierPath.getKey(Constants.INSTANCEID).getValue();
        // Mapping had been already constructed between TierID --> Policy
        List<CIMObjectPath> policyPaths = (List<CIMObjectPath>) keyMap.get(tierID);
        // add Policy to Tier
        addFastPolicyToTier(policyPaths, tierID);
        // add Pools to Policy
        addStoragePoolstoPolicy(policyPaths, it, _dbClient, keyMap, tierID);
    } catch (Exception e) {
        _logger.error("Tiers to Pool Processing failed:", e);
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) Iterator(java.util.Iterator) List(java.util.List) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 58 with BaseCollectionException

use of com.emc.storageos.plugins.BaseCollectionException 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);
    }
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) StoragePool(com.emc.storageos.db.client.model.StoragePool) CIMObjectPath(javax.cim.CIMObjectPath) AccessProfile(com.emc.storageos.plugins.AccessProfile) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 59 with BaseCollectionException

use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.

the class CreatePoolSettingProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    String tierMethodologyToBeUsedForThisCreatedSetting = null;
    try {
        if (resultObj instanceof CIMArgument<?>[]) {
            CIMArgument<?>[] outputArguments = (CIMArgument<?>[]) resultObj;
            CIMObjectPath path = (CIMObjectPath) outputArguments[0].getValue();
            // always set
            int index = (Integer) _args.get(1);
            @SuppressWarnings("unchecked") List<String> poolSettingsList = (List<String>) keyMap.get(Constants.VNXPOOLCAPABILITIES_TIER);
            String poolSettingToTierMethodology = poolSettingsList.get(index);
            tierMethodologyToBeUsedForThisCreatedSetting = poolSettingToTierMethodology.substring(poolSettingToTierMethodology.lastIndexOf(Constants.HYPHEN) + 1, poolSettingToTierMethodology.length());
            String poolCapabilitiesPathAssociatedWiththisSetting = poolSettingToTierMethodology.substring(0, poolSettingToTierMethodology.lastIndexOf(Constants.HYPHEN));
            keyMap.put(path.toString(), poolCapabilitiesPathAssociatedWiththisSetting);
            keyMap.put(path.toString() + Constants.HYPHEN + Constants.TIERMETHODOLOGY, tierMethodologyToBeUsedForThisCreatedSetting);
            addPath(keyMap, operation.getResult(), path);
        }
    } catch (Exception e) {
        _logger.error("Error processing Create Pool Setting with Initial Storage Tiering Methodology : {} : ", tierMethodologyToBeUsedForThisCreatedSetting, e);
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) List(java.util.List) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) CIMArgument(javax.cim.CIMArgument)

Example 60 with BaseCollectionException

use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.

the class SettingsInstanceProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        final CIMInstance poolSettingInstance = (CIMInstance) resultObj;
        addInstance(keyMap, operation.getResult(), poolSettingInstance);
    } catch (Exception e) {
        _logger.error("Processing Pool Setting Instances failed :", e);
    }
}
Also used : CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Aggregations

BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)185 Iterator (java.util.Iterator)66 CIMInstance (javax.cim.CIMInstance)66 CIMObjectPath (javax.cim.CIMObjectPath)59 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)55 IOException (java.io.IOException)47 URI (java.net.URI)47 ArrayList (java.util.ArrayList)47 PostMethod (org.apache.commons.httpclient.methods.PostMethod)36 ResponsePacket (com.emc.nas.vnxfile.xmlapi.ResponsePacket)35 Status (com.emc.nas.vnxfile.xmlapi.Status)33 AccessProfile (com.emc.storageos.plugins.AccessProfile)30 List (java.util.List)30 Map (java.util.Map)30 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)28 StoragePool (com.emc.storageos.db.client.model.StoragePool)27 Header (org.apache.commons.httpclient.Header)27 StoragePort (com.emc.storageos.db.client.model.StoragePort)22 HashSet (java.util.HashSet)18 URISyntaxException (java.net.URISyntaxException)17