diff options
| author | liyingjun <liyingjun1988@gmail.com> | 2014-06-04 06:28:45 +0800 |
|---|---|---|
| committer | liyingjun <liyingjun1988@gmail.com> | 2014-08-02 00:08:08 +0800 |
| commit | f7e9ece40ba33c70c8f73fb4bfb294a8bf806b61 (patch) | |
| tree | 965147f56c50761e3ca9c5158fdb850483e9d1cf /cinderclient/v2/shell.py | |
| parent | d77b6f8287bb6762d168d1f0fef706b877d0e863 (diff) | |
| download | python-cinderclient-f7e9ece40ba33c70c8f73fb4bfb294a8bf806b61.tar.gz | |
Support pagination for volume list
Since v2 api supports pagination, we should add this support in
cinderclient too.
Change-Id: I9d4cb9e192523c14cf7df043deabe156dbb8e216
Closes-bug: 1325773
Diffstat (limited to 'cinderclient/v2/shell.py')
| -rw-r--r-- | cinderclient/v2/shell.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py index ec6ee68..471240d 100644 --- a/cinderclient/v2/shell.py +++ b/cinderclient/v2/shell.py @@ -156,6 +156,27 @@ def _extract_metadata(args): help='Filters results by a metadata key and value pair. ' 'OPTIONAL: Default=None.', default=None) +@utils.arg('--marker', + metavar='<marker>', + default=None, + help='Begin returning volumes that appear later in the volume ' + 'list than that represented by this volume id. ' + 'OPTIONAL: Default=None.') +@utils.arg('--limit', + metavar='<limit>', + default=None, + help='Maximum number of volumes to return. OPTIONAL: Default=None.') +@utils.arg('--sort_key', + metavar='<sort_key>', + default=None, + help='Key to be sorted, should be (`id`, `status`, `size`, ' + '`availability_zone`, `name`, `bootable`, `created_at`). ' + 'OPTIONAL: Default=None.') +@utils.arg('--sort_dir', + metavar='<sort_dir>', + default=None, + help='Sort direction, should be `desc` or `asc`. ' + 'OPTIONAL: Default=None.') @utils.service_type('volumev2') def do_list(cs, args): """Lists all volumes.""" @@ -170,7 +191,9 @@ def do_list(cs, args): 'status': args.status, 'metadata': _extract_metadata(args) if args.metadata else None, } - volumes = cs.volumes.list(search_opts=search_opts) + volumes = cs.volumes.list(search_opts=search_opts, marker=args.marker, + limit=args.limit, sort_key=args.sort_key, + sort_dir=args.sort_dir) _translate_volume_keys(volumes) # Create a list of servers to which the volume is attached |
