diff options
| author | Zuul <zuul@review.openstack.org> | 2018-01-16 07:37:17 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2018-01-16 07:37:17 +0000 |
| commit | 24e46d116a14648652a1b67d9c2e98df953a8f38 (patch) | |
| tree | c523fd9d939415a5a0267d8e62f5b085b303fd27 /cinderclient/v3/shell.py | |
| parent | 97925fe2519d035895990617fdceee9f72f3833d (diff) | |
| parent | 1a4176ad87da88a39e4bd04e2c55e8109215d591 (diff) | |
| download | python-cinderclient-24e46d116a14648652a1b67d9c2e98df953a8f38.tar.gz | |
Merge "Add cluster support in manage listings"
Diffstat (limited to 'cinderclient/v3/shell.py')
| -rw-r--r-- | cinderclient/v3/shell.py | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py index 644cc05..d27ce20 100644 --- a/cinderclient/v3/shell.py +++ b/cinderclient/v3/shell.py @@ -1139,10 +1139,20 @@ def do_manage(cs, args): @api_versions.wraps('3.8') -@utils.arg('host', - metavar='<host>', - help='Cinder host on which to list manageable volumes; ' - 'takes the form: host@backend-name#pool') +# NOTE(geguileo): host is positional but optional in order to maintain backward +# compatibility even with mutually exclusive arguments. If version is < 3.16 +# then only host positional argument will be possible, and since the +# exclusive_arg group has required=True it will be required even if it's +# optional. +@utils.exclusive_arg('source', 'host', required=True, nargs='?', + metavar='<host>', + help='Cinder host on which to list manageable volumes; ' + 'takes the form: host@backend-name#pool') +@utils.exclusive_arg('source', '--cluster', required=True, + metavar='CLUSTER', + help='Cinder cluster on which to list manageable ' + 'volumes; takes the form: cluster@backend-name#pool', + start_version='3.17') @utils.arg('--detailed', metavar='<detailed>', default=True, @@ -1174,9 +1184,11 @@ def do_manageable_list(cs, args): """Lists all manageable volumes.""" # pylint: disable=function-redefined detailed = strutils.bool_from_string(args.detailed) + cluster = getattr(args, 'cluster', None) volumes = cs.volumes.list_manageable(host=args.host, detailed=detailed, marker=args.marker, limit=args.limit, - offset=args.offset, sort=args.sort) + offset=args.offset, sort=args.sort, + cluster=cluster) columns = ['reference', 'size', 'safe_to_manage'] if detailed: columns.extend(['reason_not_safe', 'cinder_id', 'extra_info']) @@ -1601,10 +1613,19 @@ def do_service_list(cs, args): @api_versions.wraps('3.8') -@utils.arg('host', - metavar='<host>', - help='Cinder host on which to list manageable snapshots; ' - 'takes the form: host@backend-name#pool') +# NOTE(geguileo): host is positional but optional in order to maintain backward +# compatibility even with mutually exclusive arguments. If version is < 3.16 +# then only host positional argument will be possible, and since the +# exclusive_arg group has required=True it will be required even if it's +# optional. +@utils.exclusive_arg('source', 'host', required=True, nargs='?', + metavar='<host>', + help='Cinder host on which to list manageable snapshots; ' + 'takes the form: host@backend-name#pool') +@utils.exclusive_arg('source', '--cluster', required=True, + help='Cinder cluster on which to list manageable ' + 'snapshots; takes the form: cluster@backend-name#pool', + start_version='3.17') @utils.arg('--detailed', metavar='<detailed>', default=True, @@ -1636,12 +1657,14 @@ def do_snapshot_manageable_list(cs, args): """Lists all manageable snapshots.""" # pylint: disable=function-redefined detailed = strutils.bool_from_string(args.detailed) + cluster = getattr(args, 'cluster', None) snapshots = cs.volume_snapshots.list_manageable(host=args.host, detailed=detailed, marker=args.marker, limit=args.limit, offset=args.offset, - sort=args.sort) + sort=args.sort, + cluster=cluster) columns = ['reference', 'size', 'safe_to_manage', 'source_reference'] if detailed: columns.extend(['reason_not_safe', 'cinder_id', 'extra_info']) |
