Add new node name filter API¶
This blueprint proposes adding a way to filter nodes in the API by their name (regex,wildcard).
GET /v1/nodes/?name_regex=<regexp_str> GET /v1/nodes/?name_wildcard=<wildcard_str>
Current there is only api GET /v1/nodes/<node_name> to exactly retrieve the ironic node via node_name. However for customer, if regular and wildcard expressions filters are supported to retrieve the nodes via user input, that should be useful for user to filter nodes by name flexible, especially for the users who have a lot of baremetal nodes which are managed by ironic.
Possible use case is to support client bulk operations, such as to power off some nodes which are filtered out by node name regexp or wildcard, with single command.
Add new API:
We support both BRE and ERE IEEE POSIX Regular expression standard.
And will add db api support, for different databases, there are different operators for regular expression:
So we will check the current database which ironic is using, and get the regular expression operator from the above map. If there is no such db in the above supporting map, will raise api exception to user and tell user the current database is not supported for this name regex query api.
For wildcard filter, all database can support, because will run with ‘LIKE’ SQL operator which is standard SQL.
Use node tags for client bulk operations.
Data model impact¶
State Machine Impact¶
REST API impact¶
Add new API ‘GET /v1/nodes/?name_regexp=<regexp_str>’, and ‘GET /v1/nodes/ ?name_wildcard=<wildcard_str>’, and bump API micro-version. Please see “Proposed change”.
Client (CLI) impact¶
Add new command that executes two new API:
ironic node-list –name-regex=<regexp_str>
ironic node-list –name-wildcard=<wildcard_str>
Have a similar modification to the OSC plugin.
RPC API impact¶
Driver API impact¶
Nova driver impact¶
Other end user impact¶
Other deployer impact¶
- Primary assignee:
Add new API ‘GET /v1/nodes/?name_regex=<regexp_str>’
Add new API ‘GET /v1/nodes/?name_wildcard=<wildcard_str>’
Add new ‘name_regex filter’ option for ironic node-list command.
Add new ‘name_widcard filter’ option for ironic node-list command.
Add new ‘name_regex filter’ option for the existing commands which take node id as input to support bulk operation.
Add new ‘name_widcard filter’ option for the existing commands which take node id as input to support bulk operation.
Will add unit test code to cover the new api.
Upgrades and Backwards Compatibility¶
Update API document adding a new API