Merge "Support "server list" searching by both flavor name and ID."
This commit is contained in:
commit
c39b720f00
@ -216,7 +216,7 @@ List servers
|
|||||||
|
|
||||||
.. option:: --flavor <flavor>
|
.. option:: --flavor <flavor>
|
||||||
|
|
||||||
Search by flavor ID
|
Search by flavor (name or ID)
|
||||||
|
|
||||||
.. option:: --image <image>
|
.. option:: --image <image>
|
||||||
|
|
||||||
|
@ -712,7 +712,7 @@ class ListServer(lister.Lister):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--flavor',
|
'--flavor',
|
||||||
metavar='<flavor>',
|
metavar='<flavor>',
|
||||||
help=_('Search by flavor'),
|
help=_('Search by flavor (name or ID)'),
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--image',
|
'--image',
|
||||||
@ -789,6 +789,13 @@ class ListServer(lister.Lister):
|
|||||||
parsed_args.user_domain,
|
parsed_args.user_domain,
|
||||||
).id
|
).id
|
||||||
|
|
||||||
|
# Nova only supports list servers searching by flavor ID. So if a
|
||||||
|
# flavor name is given, map it to ID.
|
||||||
|
flavor_id = None
|
||||||
|
if parsed_args.flavor:
|
||||||
|
flavor_id = utils.find_resource(compute_client.flavors,
|
||||||
|
parsed_args.flavor).id
|
||||||
|
|
||||||
search_opts = {
|
search_opts = {
|
||||||
'reservation_id': parsed_args.reservation_id,
|
'reservation_id': parsed_args.reservation_id,
|
||||||
'ip': parsed_args.ip,
|
'ip': parsed_args.ip,
|
||||||
@ -796,7 +803,7 @@ class ListServer(lister.Lister):
|
|||||||
'name': parsed_args.name,
|
'name': parsed_args.name,
|
||||||
'instance_name': parsed_args.instance_name,
|
'instance_name': parsed_args.instance_name,
|
||||||
'status': parsed_args.status,
|
'status': parsed_args.status,
|
||||||
'flavor': parsed_args.flavor,
|
'flavor': flavor_id,
|
||||||
'image': parsed_args.image,
|
'image': parsed_args.image,
|
||||||
'host': parsed_args.host,
|
'host': parsed_args.host,
|
||||||
'tenant_id': project_id,
|
'tenant_id': project_id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user