@@ -185,6 +185,7 @@ def _prep_server_detail(compute_client, image_client, server, *, refresh=True):
185185 'user_data' : 'OS-EXT-SRV-ATTR:user_data' ,
186186 'vm_state' : 'OS-EXT-STS:vm_state' ,
187187 'pinned_availability_zone' : 'pinned_availability_zone' ,
188+ 'scheduler_hints' : 'scheduler_hints' ,
188189 }
189190 # Some columns returned by openstacksdk should not be shown because they're
190191 # either irrelevant or duplicates
@@ -205,7 +206,6 @@ def _prep_server_detail(compute_client, image_client, server, *, refresh=True):
205206 'min_count' ,
206207 'networks' ,
207208 'personality' ,
208- 'scheduler_hints' ,
209209 # aliases
210210 'volumes' ,
211211 # unnecessary
@@ -236,6 +236,11 @@ def _prep_server_detail(compute_client, image_client, server, *, refresh=True):
236236
237237 info = data
238238
239+ # NOTE(dviroel): microversion 2.100 is now retrieving scheduler_hints
240+ # content from request_spec on detailed responses
241+ if not sdk_utils .supports_microversion (compute_client , '2.100' ):
242+ info .pop ('scheduler_hints' , None )
243+
239244 # Convert the image blob to a name
240245 image_info = info .get ('image' , {})
241246 if image_info and any (image_info .values ()):
@@ -322,6 +327,11 @@ def _prep_server_detail(compute_client, image_client, server, *, refresh=True):
322327 info ['OS-EXT-STS:power_state' ]
323328 )
324329
330+ if 'scheduler_hints' in info :
331+ info ['scheduler_hints' ] = format_columns .DictListColumn (
332+ info .pop ('scheduler_hints' , {}),
333+ )
334+
325335 return info
326336
327337
@@ -2834,12 +2844,14 @@ def take_action(self, parsed_args):
28342844 'pinned_availability_zone' ,
28352845 'hypervisor_hostname' ,
28362846 'metadata' ,
2847+ 'scheduler_hints' ,
28372848 )
28382849 column_headers += (
28392850 'Availability Zone' ,
28402851 'Pinned Availability Zone' ,
28412852 'Host' ,
28422853 'Properties' ,
2854+ 'Scheduler Hints' ,
28432855 )
28442856
28452857 # support for additional columns
@@ -2884,6 +2896,12 @@ def take_action(self, parsed_args):
28842896 if c in ('Properties' , "properties" ):
28852897 columns += ('Metadata' ,)
28862898 column_headers += ('Properties' ,)
2899+ if c in (
2900+ 'scheduler_hints' ,
2901+ "Scheduler Hints" ,
2902+ ):
2903+ columns += ('scheduler_hints' ,)
2904+ column_headers += ('Scheduler Hints' ,)
28872905
28882906 # remove duplicates
28892907 column_headers = tuple (dict .fromkeys (column_headers ))
@@ -3050,6 +3068,7 @@ def take_action(self, parsed_args):
30503068 'metadata' : format_columns .DictColumn ,
30513069 'security_groups_name' : format_columns .ListColumn ,
30523070 'hypervisor_hostname' : HostColumn ,
3071+ 'scheduler_hints' : format_columns .DictListColumn ,
30533072 },
30543073 )
30553074 for s in data
0 commit comments