Search in sources :

Example 1 with VArrayAttributeList

use of com.emc.storageos.model.varray.VArrayAttributeList in project coprhd-controller by CoprHD.

the class VirtualArrayService method getAvailableAttributes.

/**
 * Finds the available attributes & its values in a varray. Ex: In a
 * varray, if a system supports raid_levels such as RAID1, RAID2 then
 * this API call provides the supported information.
 *
 * @brief List available attributes for all VirtualArrays
 * @return List available attributes for all VirtualArrays
 */
@POST
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/available-attributes")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public VArrayAttributeList getAvailableAttributes(BulkIdParam param) {
    _log.info("Finding the available attributes for all varray: {}");
    VArrayAttributeList vArrayAttributes = new VArrayAttributeList();
    ObjectLocalCache cache = new ObjectLocalCache(_dbClient);
    Map<URI, List<StoragePool>> allPools = getVirtualArrayPools(param.getIds(), cache);
    for (Map.Entry<URI, List<StoragePool>> varrEntry : allPools.entrySet()) {
        Map<String, Set<String>> availableAttrs = _matcherFramework.getAvailableAttributes(varrEntry.getKey(), varrEntry.getValue(), cache, AttributeMatcher.VPOOL_MATCHERS);
        AttributeList list = new AttributeList();
        list.setVArrayId(varrEntry.getKey());
        for (Map.Entry<String, Set<String>> entry : availableAttrs.entrySet()) {
            list.getAttributes().add(new VirtualPoolAvailableAttributesResourceRep(entry.getKey(), entry.getValue()));
        }
        if (!list.getAttributes().isEmpty()) {
            vArrayAttributes.getAttributes().add(list);
        }
    }
    cache.clearCache();
    return vArrayAttributes;
}
Also used : VArrayAttributeList(com.emc.storageos.model.varray.VArrayAttributeList) Set(java.util.Set) HashSet(java.util.HashSet) StringSet(com.emc.storageos.db.client.model.StringSet) ObjectLocalCache(com.emc.storageos.volumecontroller.impl.utils.ObjectLocalCache) VArrayAttributeList(com.emc.storageos.model.varray.VArrayAttributeList) AttributeList(com.emc.storageos.model.varray.AttributeList) URI(java.net.URI) VirtualPoolAvailableAttributesResourceRep(com.emc.storageos.model.vpool.VirtualPoolAvailableAttributesResourceRep) StoragePortGroupRestRepList(com.emc.storageos.model.portgroup.StoragePortGroupRestRepList) VArrayAttributeList(com.emc.storageos.model.varray.VArrayAttributeList) NamedElementQueryResultList(com.emc.storageos.db.client.constraint.NamedElementQueryResultList) StoragePortList(com.emc.storageos.model.ports.StoragePortList) ArrayList(java.util.ArrayList) StoragePoolList(com.emc.storageos.model.pools.StoragePoolList) VirtualArrayConnectivityList(com.emc.storageos.model.varray.VirtualArrayConnectivityList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) VirtualArrayList(com.emc.storageos.model.varray.VirtualArrayList) AttributeList(com.emc.storageos.model.varray.AttributeList) List(java.util.List) AutoTierPolicyList(com.emc.storageos.model.block.tier.AutoTierPolicyList) BulkList(com.emc.storageos.api.service.impl.response.BulkList) VirtualPoolList(com.emc.storageos.model.vpool.VirtualPoolList) NetworkList(com.emc.storageos.model.varray.NetworkList) Map(java.util.Map) HashMap(java.util.HashMap) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 2 with VArrayAttributeList

use of com.emc.storageos.model.varray.VArrayAttributeList in project coprhd-controller by CoprHD.

the class VirtualArrays method getAvailableAttributes.

/**
 * Gets the available attributes for the given virtual arrays.
 * <p>
 * API Call: <tt>GET /vdc/varrays/available-attributes</tt>
 *
 * @param virtualArrayIds
 *            the IDs of the virtual arrays.
 * @return the list of available attributes.
 */
public Map<URI, List<VirtualPoolAvailableAttributesResourceRep>> getAvailableAttributes(Collection<URI> virtualArrayIds) {
    BulkIdParam input = new BulkIdParam((List<URI>) virtualArrayIds);
    VArrayAttributeList response = client.post(VArrayAttributeList.class, input, PathConstants.AVAILABLE_ATTRIBUTES_FOR_ALL_VARRAY);
    Map<URI, List<VirtualPoolAvailableAttributesResourceRep>> availableAttributes = new HashMap<URI, List<VirtualPoolAvailableAttributesResourceRep>>();
    for (AttributeList attributes : response.getAttributes()) {
        availableAttributes.put(attributes.getVArrayId(), attributes.getAttributes());
    }
    return availableAttributes;
}
Also used : VArrayAttributeList(com.emc.storageos.model.varray.VArrayAttributeList) VirtualPoolAvailableAttributesResourceRep(com.emc.storageos.model.vpool.VirtualPoolAvailableAttributesResourceRep) BulkIdParam(com.emc.storageos.model.BulkIdParam) HashMap(java.util.HashMap) AttributeList(com.emc.storageos.model.varray.AttributeList) VArrayAttributeList(com.emc.storageos.model.varray.VArrayAttributeList) ResourceUtils.defaultList(com.emc.vipr.client.core.util.ResourceUtils.defaultList) StoragePortGroupRestRepList(com.emc.storageos.model.portgroup.StoragePortGroupRestRepList) VirtualArrayList(com.emc.storageos.model.varray.VirtualArrayList) AttributeList(com.emc.storageos.model.varray.AttributeList) StoragePortGroupList(com.emc.storageos.model.portgroup.StoragePortGroupList) VirtualArrayConnectivityList(com.emc.storageos.model.varray.VirtualArrayConnectivityList) List(java.util.List) VArrayAttributeList(com.emc.storageos.model.varray.VArrayAttributeList) URI(java.net.URI)

Aggregations

StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)2 AttributeList (com.emc.storageos.model.varray.AttributeList)2 VArrayAttributeList (com.emc.storageos.model.varray.VArrayAttributeList)2 VirtualArrayConnectivityList (com.emc.storageos.model.varray.VirtualArrayConnectivityList)2 VirtualArrayList (com.emc.storageos.model.varray.VirtualArrayList)2 VirtualPoolAvailableAttributesResourceRep (com.emc.storageos.model.vpool.VirtualPoolAvailableAttributesResourceRep)2 URI (java.net.URI)2 HashMap (java.util.HashMap)2 List (java.util.List)2 BulkList (com.emc.storageos.api.service.impl.response.BulkList)1 NamedElementQueryResultList (com.emc.storageos.db.client.constraint.NamedElementQueryResultList)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 StringSet (com.emc.storageos.db.client.model.StringSet)1 BulkIdParam (com.emc.storageos.model.BulkIdParam)1 AutoTierPolicyList (com.emc.storageos.model.block.tier.AutoTierPolicyList)1 StoragePoolList (com.emc.storageos.model.pools.StoragePoolList)1 StoragePortGroupList (com.emc.storageos.model.portgroup.StoragePortGroupList)1 StoragePortList (com.emc.storageos.model.ports.StoragePortList)1 NetworkList (com.emc.storageos.model.varray.NetworkList)1 VirtualPoolList (com.emc.storageos.model.vpool.VirtualPoolList)1