Add option to filter instances by AZ
Since nova API microversion 2.83 it is possible for users to filter instances by AZ. However even before that this functionality was available for admin role. Change-Id: Ife4c8e81aad2ff1dde50d9f23913d9dd9397b00c
This commit is contained in:
parent
8387b114e3
commit
0f02029d91
openstackclient
@ -1365,6 +1365,13 @@ class ListServer(command.Lister):
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListServer, self).get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--availability-zone',
|
||||
metavar='<availability-zone>',
|
||||
help=_('Only return instances that match the availability zone. '
|
||||
'Note that this option will be ignored for non-admin users '
|
||||
'when using ``--os-compute-api-version`` prior to 2.83.'),
|
||||
)
|
||||
parser.add_argument(
|
||||
'--reservation-id',
|
||||
metavar='<reservation-id>',
|
||||
@ -1574,6 +1581,7 @@ class ListServer(command.Lister):
|
||||
ignore_missing=False).id
|
||||
|
||||
search_opts = {
|
||||
'availability_zone': parsed_args.availability_zone,
|
||||
'reservation_id': parsed_args.reservation_id,
|
||||
'ip': parsed_args.ip,
|
||||
'ip6': parsed_args.ip6,
|
||||
|
@ -2962,6 +2962,7 @@ class TestServerList(TestServer):
|
||||
super(TestServerList, self).setUp()
|
||||
|
||||
self.search_opts = {
|
||||
'availability_zone': None,
|
||||
'reservation_id': None,
|
||||
'ip': None,
|
||||
'ip6': None,
|
||||
|
Loading…
x
Reference in New Issue
Block a user