Expose all filter options for collections in REST api

Registered by Nate House

The current GET collections methods do not expose all the filtering that is included in the sqlalchemy interface. The missing filters include [reserved, driver, provision_state, provisioned_before, inspection_started_before] and do exist in the ironic.db.sqlalchemy.api.Connection._add_nodes_filters methods but are not included in the ironic.api.controllers.v1.node.NodesController._get_nodes_collection or related methods. Due to the previous declaration conventions and the api's expose type validation, adding an additional filters optional parameter would mask the expose type validation for the filters and so implementations might be limited to additional optional parameters for each. It would be nice to allow filtering on any/all available fields in the collection and base the type validation on the type defined in the sqlalchemy table declaration.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
Nate House
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

https://github.com/openstack/ironic/blob/master/ironic/api/controllers/v1/node.py#L995-L1027 - get_all node collection method definition

https://github.com/openstack/ironic/blob/master/ironic/api/controllers/v1/node.py#L883-L929 - _get_nodes_collection helper method definition

https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/api.py#L152-L190 - _add_nodes_filters sqlalchemy method definition

https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/models.py#L99-L152 - node sqlalchemy table definition for basic type validation

Ideally it would be nice to accept any/all available table columns as filters. Operator implementations could also clean up the conditional checks when applying filters. Because the current filters are exclusively declared as optional params, adding an additional filters param that accepts json should likely include those existing filters and leave the definition as is for backwards compat.

Hi Nate, if you plan to work on this, please use referenced RFE bug instead of this blueprint.
//vdrok 2015-12-15

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.