Search in sources :

Example 1 with VPlexHighAvailabilityMatcher

use of com.emc.storageos.volumecontroller.impl.utils.attrmatchers.VPlexHighAvailabilityMatcher in project coprhd-controller by CoprHD.

the class PlacementTestUtils method runVPlexHighAvailabilityMatcher.

/**
 * Runs the VPLEX high availability matcher
 * @param vpool
 * @param pools
 * @return
 */
public static StringSet runVPlexHighAvailabilityMatcher(DbClientImpl dbClient, VirtualPool vpool, List<StoragePool> pools) {
    Set<String> poolNames = new HashSet<String>();
    for (StoragePool pool : pools) {
        poolNames.add(pool.getLabel());
    }
    _log.info("Calling VPlexHighAvailabilityMatcher on pools: " + poolNames.toString());
    VPlexHighAvailabilityMatcher matcher = new VPlexHighAvailabilityMatcher();
    ObjectLocalCache cache = new ObjectLocalCache(dbClient);
    matcher.setObjectCache(cache);
    Map<String, Object> attributeMap = new HashMap<String, Object>();
    attributeMap.put(Attributes.high_availability_type.name(), vpool.getHighAvailability());
    attributeMap.put(Attributes.varrays.name(), vpool.getVirtualArrays());
    attributeMap.put(Attributes.high_availability_varray.name(), null);
    attributeMap.put(Attributes.high_availability_vpool.name(), null);
    if (vpool.getHaVarrayVpoolMap() != null) {
        for (Map.Entry<String, String> entry : vpool.getHaVarrayVpoolMap().entrySet()) {
            attributeMap.put(Attributes.high_availability_varray.name(), entry.getKey());
            attributeMap.put(Attributes.high_availability_vpool.name(), entry.getValue());
        }
    }
    StringBuffer errorMessage = new StringBuffer();
    List<StoragePool> matchedPools = matcher.matchStoragePoolsWithAttributeOn(pools, attributeMap, errorMessage);
    StringSet result = new StringSet();
    for (StoragePool matchedPool : matchedPools) {
        result.add(matchedPool.getId().toString());
    }
    _log.info("Matched results: " + result.toString());
    return result;
}
Also used : VPlexHighAvailabilityMatcher(com.emc.storageos.volumecontroller.impl.utils.attrmatchers.VPlexHighAvailabilityMatcher) StoragePool(com.emc.storageos.db.client.model.StoragePool) HashMap(java.util.HashMap) ObjectLocalCache(com.emc.storageos.volumecontroller.impl.utils.ObjectLocalCache) StringSet(com.emc.storageos.db.client.model.StringSet) DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject) HashMap(java.util.HashMap) Map(java.util.Map) StringSetMap(com.emc.storageos.db.client.model.StringSetMap) StringMap(com.emc.storageos.db.client.model.StringMap) HashSet(java.util.HashSet)

Aggregations

DiscoveredDataObject (com.emc.storageos.db.client.model.DiscoveredDataObject)1 DiscoveredSystemObject (com.emc.storageos.db.client.model.DiscoveredSystemObject)1 StoragePool (com.emc.storageos.db.client.model.StoragePool)1 StringMap (com.emc.storageos.db.client.model.StringMap)1 StringSet (com.emc.storageos.db.client.model.StringSet)1 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)1 ObjectLocalCache (com.emc.storageos.volumecontroller.impl.utils.ObjectLocalCache)1 VPlexHighAvailabilityMatcher (com.emc.storageos.volumecontroller.impl.utils.attrmatchers.VPlexHighAvailabilityMatcher)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1