Bug 1041711

Summary: [RFE][cinder]: List volume types should support search extra_specs options (filters)
Product: Red Hat OpenStack Reporter: RHOS Integration <rhos-integ>
Component: RFEsAssignee: RHOS Maint <rhos-maint>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: markmc, yeylon
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://blueprints.launchpad.net/cinder/+spec/list-volume-types-filters
Whiteboard: upstream_milestone_none upstream_status_unknown upstream_definition_obsolete
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-19 17:14:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description RHOS Integration 2013-12-12 18:45:50 UTC
Cloned from launchpad blueprint https://blueprints.launchpad.net/cinder/+spec/list-volume-types-filters.

Description:

The list volume types (GET) API currently only lists all the existing volume types.
​https://github.com/openstack/cinder/blob/master/cinder/api/v2/types.py#L58

However, the internal method called by this API supports searching the volume types by accepting search_options. This is not utilized by the list volume types method, hence user cannot leverage this filter functionality.
Update cinder volume_types index() method to accept search options according to the volume type's extra specs, and display the filtered results.
Eg: There are two volume types in the system:
{
    "volume_types": [
        {
            "extra_specs": {'capabilities': 'gpu'},
            "id": "6685584b-1eac-4da6-b5c3-555430cf68ff",
            "name": "SSD"
        },
        {
            "extra_specs": {'capabilities': 'datamotion'},
            "id": "8eb69a46-df97-4e41-9586-9a40a7533803",
            "name": "SATA"
        }
    ]
}
GET ​http://10.2.3.102:8776/v2/73918d5d3656403e9c76f76c26a1f6e0/types?extra_specs={"capabilities":"gpu"}
should return only:
{
    "volume_types": [
        {
            "extra_specs": {'capabilities': 'gpu'},
            "id": "6685584b-1eac-4da6-b5c3-555430cf68ff",
            "name": "SSD"
        }
     ]
}
If user requests for all the volume types that support 'gpu' capability, then only those volume types should be displayed. Currently this functionality is not provided by the public API but internal support is there as per
​https://github.com/openstack/cinder/blob/master/cinder/volume/volume_types.py#L60

Here 'user' ==> admin user.

Add the above support in Cinder.

Specification URL (additional information):

None