Add metadata as a filter condition when listing volumes · openstack/python-openstackclient@572eeb6 · GitHub
Skip to content

Commit 572eeb6

Browse files
ohjiwoostephenfin
authored andcommitted
Add metadata as a filter condition when listing volumes
When listing volumes, the API provides metadata as a query parameter, but this feature is not implemented in the client code. So add parameter. story: 2011487 task: 52446 Change-Id: I4bf66d4e073c86296fa96ee29c2b33d771e18293 Signed-off-by: ohjiwoo <jiwooo.oh@samsung.com>
1 parent 88b59d8 commit 572eeb6

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

openstackclient/tests/unit/volume/v3/test_volume.py

Lines changed: 11 additions & 0 deletions

openstackclient/volume/v3/volume.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,16 @@ def get_parser(self, prog_name):
574574
metavar='<status>',
575575
help=_('Filter results by status'),
576576
)
577+
parser.add_argument(
578+
'--property',
579+
metavar='<key=value>',
580+
action=parseractions.KeyValueAction,
581+
dest='properties',
582+
help=_(
583+
'Filter by a property on the volume list '
584+
'(repeat option to filter by multiple properties) '
585+
),
586+
)
577587
parser.add_argument(
578588
'--all-projects',
579589
action='store_true',
@@ -642,6 +652,7 @@ def take_action(self, parsed_args):
642652
'user_id': user_id,
643653
'name': parsed_args.name,
644654
'status': parsed_args.status,
655+
'metadata': parsed_args.properties,
645656
}
646657

647658
data = volume_client.volumes.list(
Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)