diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-10-05 15:22:13 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-10-05 15:22:13 +0000 |
commit | 30793d6c57fa3c68d33d3964d320577dc4e1db77 (patch) | |
tree | 7502098bf5f0d17a86d304e92a5adbe312c3343a /cinderclient/v3/shell.py | |
parent | a1162d622311734013e0359469bcdc3b3f1c6b60 (diff) | |
parent | a3c5e06693f774d843bfebd7e3a3d26589e9f0e1 (diff) | |
download | python-cinderclient-30793d6c57fa3c68d33d3964d320577dc4e1db77.tar.gz |
Merge "Volume detail support glance_metadata in CLI"
Diffstat (limited to 'cinderclient/v3/shell.py')
-rw-r--r-- | cinderclient/v3/shell.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py index ccf2f1c..1b38979 100644 --- a/cinderclient/v3/shell.py +++ b/cinderclient/v3/shell.py @@ -150,9 +150,13 @@ def _translate_availability_zone_keys(collection): _translate_keys(collection, convert) -def _extract_metadata(args): +def _extract_metadata(args, type='user_metadata'): metadata = {} - for metadatum in args.metadata: + if type == 'image_metadata': + args_metadata = args.image_metadata + else: + args_metadata = args.metadata + for metadatum in args_metadata: # unset doesn't require a val, so we have the if/else if '=' in metadatum: (key, value) = metadatum.split('=', 1) @@ -203,7 +207,14 @@ def _extract_metadata(args): nargs='*', metavar='<key=value>', default=None, - help='Filters results by a metadata key and value pair. ' + help='Filters results by a metadata key and value pair. Require ' + 'volume api version >=3.4. Default=None.') +@utils.arg('--image_metadata', + type=str, + nargs='*', + metavar='<key=value>', + default=None, + help='Filters results by a image metadata key and value pair. ' 'Default=None.') @utils.arg('--marker', metavar='<marker>', @@ -260,6 +271,8 @@ def do_list(cs, args): 'bootable': args.bootable, 'migration_status': args.migration_status, 'metadata': _extract_metadata(args) if args.metadata else None, + 'glance_metadata': _extract_metadata(args, type='image_metadata') + if args.image_metadata else None, } # If unavailable/non-existent fields are specified, these fields will |