File tree Expand file tree Collapse file tree
doc/source/command-objects
openstackclient/compute/v2 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -220,7 +220,7 @@ List servers
220220
221221.. option:: --image < image>
222222
223- Search by image ID
223+ Search by image (name or ID)
224224
225225.. option:: --host < hostname>
226226
Original file line number Diff line number Diff line change @@ -717,7 +717,7 @@ def get_parser(self, prog_name):
717717 parser .add_argument (
718718 '--image' ,
719719 metavar = '<image>' ,
720- help = _ ('Search by image' ),
720+ help = _ ('Search by image (name or ID) ' ),
721721 )
722722 parser .add_argument (
723723 '--host' ,
@@ -796,6 +796,13 @@ def take_action(self, parsed_args):
796796 flavor_id = utils .find_resource (compute_client .flavors ,
797797 parsed_args .flavor ).id
798798
799+ # Nova only supports list servers searching by image ID. So if a
800+ # image name is given, map it to ID.
801+ image_id = None
802+ if parsed_args .image :
803+ image_id = utils .find_resource (compute_client .images ,
804+ parsed_args .image ).id
805+
799806 search_opts = {
800807 'reservation_id' : parsed_args .reservation_id ,
801808 'ip' : parsed_args .ip ,
@@ -804,7 +811,7 @@ def take_action(self, parsed_args):
804811 'instance_name' : parsed_args .instance_name ,
805812 'status' : parsed_args .status ,
806813 'flavor' : flavor_id ,
807- 'image' : parsed_args . image ,
814+ 'image' : image_id ,
808815 'host' : parsed_args .host ,
809816 'tenant_id' : project_id ,
810817 'all_tenants' : parsed_args .all_projects ,
You can’t perform that action at this time.
0 commit comments