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;
}
Aggregations