Search in sources :

Example 36 with AccessProfile

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

the class VolumeSettingProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        StorageSystem system = _dbClient.queryObject(StorageSystem.class, profile.getSystemId());
        final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        CIMObjectPath volumePath = getObjectPathfromCIMArgument(_args);
        String nativeGuid = getUnManagedVolumeNativeGuidFromVolumePath(volumePath);
        UnManagedVolume unManagedVolume = checkUnManagedVolumeExistsInDB(nativeGuid, _dbClient);
        if (null == unManagedVolume) {
            return;
        }
        while (it.hasNext()) {
            CIMInstance settingInstance = it.next();
            String initialTierSetting = settingInstance.getPropertyValue(Constants.INITIAL_STORAGE_TIER_METHODOLOGY).toString();
            String policyName = null;
            if ("4".equalsIgnoreCase(initialTierSetting)) {
                policyName = AutoTieringPolicy.VnxFastPolicy.DEFAULT_START_HIGH_THEN_AUTOTIER.name();
            } else {
                policyName = AutoTieringPolicy.VnxFastPolicy.DEFAULT_AUTOTIER.name();
            }
            _logger.info("Adding {} Policy Rule to UnManaged Volume {}", policyName, nativeGuid);
            unManagedVolume.getVolumeInformation().put(SupportedVolumeInformation.AUTO_TIERING_POLICIES.toString(), policyName);
            unManagedVolume.putVolumeCharacterstics(SupportedVolumeCharacterstics.IS_AUTO_TIERING_ENABLED.toString(), "true");
            // StorageVolumeInfoProcessor updated supported_vpool_list based on its pool's presence in vPool
            // Now, filter those vPools based on policy associated
            DiscoveryUtils.filterSupportedVpoolsBasedOnTieringPolicy(unManagedVolume, policyName, system, _dbClient);
            _dbClient.updateAndReindexObject(unManagedVolume);
        }
    } catch (Exception e) {
        _logger.error("Updating Auto Tier Policies failed on unmanaged volumes", e);
    }
}
Also used : UnManagedVolume(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume) Iterator(java.util.Iterator) 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 37 with AccessProfile

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

the class MaskingPathProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        String serialIdsStr = profile.getProps().get(Constants.SYSTEM_SERIAL_IDS);
        String[] serialIds = serialIdsStr.split(Constants.ID_DELIMITER);
        Set<String> serialIdSet = new HashSet<String>(Arrays.asList(serialIds));
        Iterator<CIMObjectPath> it = (Iterator<CIMObjectPath>) resultObj;
        while (it.hasNext()) {
            CIMObjectPath path = it.next();
            String systemName = path.getKeyValue(SmisConstants.CP_SYSTEM_NAME).toString();
            String serialId = systemName.split(Constants.PATH_DELIMITER_REGEX)[1];
            if (serialIdSet.contains(serialId)) {
                addPath(keyMap, operation.getResult(), path);
            }
        }
    } catch (Exception e) {
        log.error("Masking path discovery failed during array affinity discovery", e);
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) Iterator(java.util.Iterator) AccessProfile(com.emc.storageos.plugins.AccessProfile) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) HashSet(java.util.HashSet)

Example 38 with AccessProfile

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

the class TierBookKeepingProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        String serialID = (String) keyMap.get(Constants._serialID);
        while (it.hasNext()) {
            CIMInstance tierInstance = it.next();
            if (tierInstance.getObjectPath().toString().contains(serialID)) {
                _tierNativeGuids.add(getTierNativeGuidFromTierInstance(tierInstance));
            }
        }
        performStorageTierBookKeeping(profile.getSystemId());
    } catch (Exception e) {
        _logger.info("BookKeeping Storage Tiers failed", e);
    }
}
Also used : Iterator(java.util.Iterator) AccessProfile(com.emc.storageos.plugins.AccessProfile) CIMInstance(javax.cim.CIMInstance) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 39 with AccessProfile

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

the class CheckPoolSettingExistenceProcessor method processResult.

@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
    _dbClient = (DbClient) keyMap.get(Constants.dbClient);
    AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
    try {
        StorageSystem device = getStorageSystem(_dbClient, profile.getSystemId());
        CIMObjectPath poolCapabilitiesPath = getObjectPathfromCIMArgument();
        String poolID = getPoolIdFromCapabilities(poolCapabilitiesPath);
        // get Pool from DB
        StoragePool pool = checkStoragePoolExistsInDB(poolID, _dbClient, device);
        List<String> poolSettingsList = (List<String>) keyMap.get(Constants.VNXPOOLCAPABILITIES_TIER);
        while (it.hasNext()) {
            CIMInstance settingInstance = it.next();
            _logger.debug("settingInstance :{}", settingInstance);
            int tierMethodology = Integer.parseInt(settingInstance.getPropertyValue(Constants.INITIAL_STORAGE_TIER_METHODOLOGY).toString());
            int tierSelection = Integer.parseInt(settingInstance.getPropertyValue(Constants.INITIAL_STORAGE_TIERING_SELECTION).toString());
            String poolSettingId = settingInstance.getPropertyValue(Constants.INSTANCEID).toString();
            if (checkPoolSettingExistsBasedOnTierMethodology(tierMethodology, pool, poolSettingId) && tierSelection == Constants.RELATIVE_PERFORMANCE_ORDER) {
                poolSettingsList.remove(poolCapabilitiesPath.toString() + Constants.HYPHEN + tierMethodology);
            }
        }
    } catch (Exception e) {
        _logger.error("CheckPoolExistence Processor failed:", e);
    }
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) CIMObjectPath(javax.cim.CIMObjectPath) AccessProfile(com.emc.storageos.plugins.AccessProfile) CIMInstance(javax.cim.CIMInstance) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Iterator(java.util.Iterator) List(java.util.List) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 40 with AccessProfile

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

the class XIVStorageProtocolEndPointProcessor 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);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        @SuppressWarnings("unchecked") Map<URI, StoragePool> poolsToMatchWithVpool = (Map<URI, StoragePool>) keyMap.get(Constants.MODIFIED_STORAGEPOOLS);
        StorageSystem device = _dbClient.queryObject(StorageSystem.class, profile.getSystemId());
        List<StoragePort> newPorts = new ArrayList<StoragePort>();
        List<StoragePort> existingPorts = new ArrayList<StoragePort>();
        while (it.hasNext()) {
            CIMInstance endPointInstance = null;
            StoragePort port = null;
            try {
                endPointInstance = it.next();
                String name = getCIMPropertyValue(endPointInstance, NAME).toLowerCase();
                String portInstanceID = getObjectPathfromCIMArgument(args).toString();
                port = checkEthernetStoragePortExistsInDB(name, _dbClient, device);
                URI portID = createEthernetStoragePort(keyMap, port, name, portInstanceID, newPorts, existingPorts);
                keyMap.put(endPointInstance.getObjectPath().toString(), portID);
                addPath(keyMap, operation.getResult(), endPointInstance.getObjectPath());
            } catch (Exception e) {
                _logger.warn("SCSI End Point Discovery failed for {}-->{}", "", getMessage(e));
            }
        }
        @SuppressWarnings("unchecked") List<List<StoragePort>> portsUsedToRunNetworkConnectivity = (List<List<StoragePort>>) keyMap.get(Constants.STORAGE_PORTS);
        portsUsedToRunNetworkConnectivity.add(newPorts);
        // discovered ports used later to check for not visible ports
        List<StoragePort> discoveredPorts = (List<StoragePort>) keyMap.get(Constants.DISCOVERED_PORTS);
        discoveredPorts.addAll(newPorts);
        discoveredPorts.addAll(existingPorts);
        List<StoragePool> modifiedPools = StoragePoolAssociationHelper.getStoragePoolsFromPorts(_dbClient, newPorts, null);
        for (StoragePool pool : modifiedPools) {
            // pool matcher will be invoked on this pool
            if (!poolsToMatchWithVpool.containsKey(pool.getId())) {
                poolsToMatchWithVpool.put(pool.getId(), pool);
            }
        }
        _logger.debug("# Pools used in invoking PoolMatcher during StorageProtoclEndPoint {}", Joiner.on("\t").join(poolsToMatchWithVpool.keySet()));
    } catch (Exception e) {
        _logger.error("SCSI End Point Discovery failed -->{}", getMessage(e));
    }
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) AccessProfile(com.emc.storageos.plugins.AccessProfile) URI(java.net.URI) CIMInstance(javax.cim.CIMInstance) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

AccessProfile (com.emc.storageos.plugins.AccessProfile)49 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)33 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)30 Iterator (java.util.Iterator)25 CIMInstance (javax.cim.CIMInstance)24 CIMObjectPath (javax.cim.CIMObjectPath)16 URI (java.net.URI)14 DbClient (com.emc.storageos.db.client.DbClient)12 List (java.util.List)11 IOException (java.io.IOException)9 ArrayList (java.util.ArrayList)9 Map (java.util.Map)9 Stat (com.emc.storageos.db.client.model.Stat)8 StoragePool (com.emc.storageos.db.client.model.StoragePool)7 SMIPluginException (com.emc.storageos.plugins.metering.smis.SMIPluginException)7 StoragePort (com.emc.storageos.db.client.model.StoragePort)6 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)5 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5 CIMArgument (javax.cim.CIMArgument)4