Support volume transfer name filters

The `name` filter for volume transfer is not currently recognized by the
API. Instead, it allowed filtering on 'display_name', which is not the
actual name of any attribute of the resource.
This patch adds the support for it while secretly continuing to
support `display_name` as a valid filter so as not to break people who
have figured out the workaround.

Change-Id: I6a4d12d5dd55080e9aa73027ed82d3bf13855e28
Closes-Bug: #1860100
This commit is contained in:
Rajat Dhasmana 2020-01-21 16:55:11 +00:00
parent cbec9d8d26
commit 41b0eb2351
3 changed files with 10 additions and 0 deletions

View File

@ -61,6 +61,8 @@ class VolumeTransferController(wsgi.Controller):
context = req.environ['cinder.context']
filters = req.params.copy()
LOG.debug('Listing volume transfers')
if 'name' in filters:
filters['display_name'] = filters.pop('name')
transfers = self.transfer_api.get_all(context, filters=filters,
sort_keys=['created_at', 'id'],
sort_dirs=['asc', 'asc'])

View File

@ -46,6 +46,8 @@ class VolumeTransferController(volume_transfer_v2.VolumeTransferController):
# as default order, but we should keep the compatible in here.
sort_keys, sort_dirs = ['created_at', 'id'], ['asc', 'asc']
filters = params
if 'name' in filters:
filters['display_name'] = filters.pop('name')
LOG.debug('Listing volume transfers')
transfers = self.transfer_api.get_all(context, marker=marker,

View File

@ -0,0 +1,6 @@
---
fixes:
- |
The volume-transfers list calls (``GET /v3/{project_id}/volume-transfers``,
``GET /v3/{project_id}/volume-transfers/detail``) were not recognizing ``name``
as a filterable attribute. That has been fixed in the current release.