summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
authorTang Chen <tangchen@cn.fujitsu.com>2015-11-17 21:44:02 +0800
committerTang Chen <tangchen@cn.fujitsu.com>2015-12-01 10:12:58 +0800
commit43c11c356b92e11a27179a02d2aab1b56fe3bc07 (patch)
treeadbb43c79d79395401c0ee94b70154b4897fc95c /openstackclient
parentb36b477e8106978669f653e4721ff023006772c6 (diff)
downloadpython-openstackclient-43c11c356b92e11a27179a02d2aab1b56fe3bc07.tar.gz
Add --limit option to "server list" command.
This option will limit the total amount of items the command will list up. Change-Id: I46af0d479d795ebb6a74585d0f76629dd940b117
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/compute/v2/server.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py
index 2e5cd99c..1d0de27e 100644
--- a/openstackclient/compute/v2/server.py
+++ b/openstackclient/compute/v2/server.py
@@ -755,6 +755,16 @@ class ListServer(lister.Lister):
' list of servers after marker. Display all servers if not'
' specified.')
)
+ parser.add_argument(
+ '--limit',
+ metavar='<limit>',
+ type=int,
+ default=None,
+ help=("Maximum number of servers to display. If limit equals -1,"
+ " all servers will be displayed. If limit is greater than"
+ " 'osapi_max_limit' option of Nova API,"
+ " 'osapi_max_limit' will be used instead."),
+ )
return parser
@utils.log_method(log)
@@ -845,7 +855,8 @@ class ListServer(lister.Lister):
parsed_args.marker).id
data = compute_client.servers.list(search_opts=search_opts,
- marker=marker_id)
+ marker=marker_id,
+ limit=parsed_args.limit)
return (column_headers,
(utils.get_item_properties(
s, columns,