@@ -148,12 +148,18 @@ def _prep_server_detail(compute_client, image_client, server, refresh=True):
148148
149149 # Convert the flavor blob to a name
150150 flavor_info = info .get ('flavor' , {})
151- flavor_id = flavor_info .get ('id' , '' )
152- try :
153- flavor = utils .find_resource (compute_client .flavors , flavor_id )
154- info ['flavor' ] = "%s (%s)" % (flavor .name , flavor_id )
155- except Exception :
156- info ['flavor' ] = flavor_id
151+ # Microversion 2.47 puts the embedded flavor into the server response
152+ # body but omits the id, so if not present we just expose the flavor
153+ # dict in the server output.
154+ if 'id' in flavor_info :
155+ flavor_id = flavor_info .get ('id' , '' )
156+ try :
157+ flavor = utils .find_resource (compute_client .flavors , flavor_id )
158+ info ['flavor' ] = "%s (%s)" % (flavor .name , flavor_id )
159+ except Exception :
160+ info ['flavor' ] = flavor_id
161+ else :
162+ info ['flavor' ] = utils .format_dict (flavor_info )
157163
158164 if 'os-extended-volumes:volumes_attached' in info :
159165 info .update (
@@ -1257,6 +1263,10 @@ def take_action(self, parsed_args):
12571263 s .flavor_name = flavor .name
12581264 s .flavor_id = s .flavor ['id' ]
12591265 else :
1266+ # TODO(mriedem): Fix this for microversion >= 2.47 where the
1267+ # flavor is embedded in the server response without the id.
1268+ # We likely need to drop the Flavor ID column in that case if
1269+ # --long is specified.
12601270 s .flavor_name = ''
12611271 s .flavor_id = ''
12621272
@@ -1994,7 +2004,9 @@ def take_action(self, parsed_args):
19942004
19952005
19962006class ShowServer (command .ShowOne ):
1997- _description = _ ("Show server details" )
2007+ _description = _ (
2008+ "Show server details. Specify ``--os-compute-api-version 2.47`` "
2009+ "or higher to see the embedded flavor information for the server." )
19982010
19992011 def get_parser (self , prog_name ):
20002012 parser = super (ShowServer , self ).get_parser (prog_name )
0 commit comments