diff options
| author | Stephen Finucane <sfinucan@redhat.com> | 2021-07-27 11:08:35 +0100 |
|---|---|---|
| committer | Stephen Finucane <sfinucan@redhat.com> | 2021-07-27 11:15:23 +0100 |
| commit | e0dc31f32eb6720059439e791713e2c61f81bf70 (patch) | |
| tree | 0b75e29e3558f49b55cdf6394f0d780013179cd2 /openstackclient/volume/v1 | |
| parent | c1209601b4f4b81690a186e51aa819c783367fae (diff) | |
| download | python-openstackclient-e0dc31f32eb6720059439e791713e2c61f81bf70.tar.gz | |
volume: Add missing 'volume list --offset' parameter
Looking at the code for the ancient v1 cinder API, we see that this
supported offset-style pagination [1][2][3]. Add this parameter,
simplifying a future patch to standardize pagination across OSC.
[1] https://github.com/openstack/cinder/blob/juno-eol/cinder/api/v1/volumes.py#L259
[2] https://github.com/openstack/cinder/blob/juno-eol/cinder/api/v1/volumes.py#L292
[3] https://github.com/openstack/cinder/blob/juno-eol/cinder/api/common.py#L120
Change-Id: Ifec208ea9ed7afb4bebced6132abb96a3af034b5
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'openstackclient/volume/v1')
| -rw-r--r-- | openstackclient/volume/v1/volume.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/openstackclient/volume/v1/volume.py b/openstackclient/volume/v1/volume.py index 460bd85a..dfbb0c54 100644 --- a/openstackclient/volume/v1/volume.py +++ b/openstackclient/volume/v1/volume.py @@ -328,6 +328,13 @@ class ListVolume(command.Lister): help=_('List additional fields in output'), ) parser.add_argument( + '--offset', + type=int, + action=parseractions.NonNegativeAction, + metavar='<offset>', + help=_('Index from which to start listing volumes'), + ) + parser.add_argument( '--limit', type=int, action=parseractions.NonNegativeAction, @@ -395,6 +402,9 @@ class ListVolume(command.Lister): 'status': parsed_args.status, } + if parsed_args.offset: + search_opts['offset'] = parsed_args.offset + data = volume_client.volumes.list( search_opts=search_opts, limit=parsed_args.limit, |
