@@ -143,6 +143,7 @@ def get_compute_quota(self, client, parsed_args):
143143 def get_volume_quota (self , client , parsed_args ):
144144 quota_class = (
145145 parsed_args .quota_class if 'quota_class' in parsed_args else False )
146+ detail = parsed_args .detail if 'detail' in parsed_args else False
146147 default = parsed_args .default if 'default' in parsed_args else False
147148 try :
148149 if quota_class :
@@ -153,7 +154,7 @@ def get_volume_quota(self, client, parsed_args):
153154 if default :
154155 quota = client .quotas .defaults (project )
155156 else :
156- quota = client .quotas .get (project )
157+ quota = client .quotas .get (project , usage = detail )
157158 except Exception as e :
158159 if type (e ).__name__ == 'EndpointNotFound' :
159160 return {}
@@ -195,7 +196,7 @@ def get_network_quota(self, parsed_args):
195196 # more consistent
196197 for key , values in network_quota .items ():
197198 if type (values ) is dict and "used" in values :
198- values [u 'in_use' ] = values .pop ("used" )
199+ values ['in_use' ] = values .pop ("used" )
199200 network_quota [key ] = values
200201 return network_quota
201202 else :
@@ -205,7 +206,8 @@ def get_network_quota(self, parsed_args):
205206class ListQuota (command .Lister , BaseQuota ):
206207 _description = _ (
207208 "List quotas for all projects with non-default quota values or "
208- "list detailed quota information for requested project" )
209+ "list detailed quota information for requested project"
210+ )
209211
210212 def _get_detailed_quotas (self , parsed_args ):
211213 columns = (
@@ -222,10 +224,21 @@ def _get_detailed_quotas(self, parsed_args):
222224 )
223225 quotas = {}
224226 if parsed_args .compute :
225- quotas .update (self .get_compute_quota (
226- self .app .client_manager .compute , parsed_args ))
227+ quotas .update (
228+ self .get_compute_quota (
229+ self .app .client_manager .compute ,
230+ parsed_args ,
231+ )
232+ )
227233 if parsed_args .network :
228234 quotas .update (self .get_network_quota (parsed_args ))
235+ if parsed_args .volume :
236+ quotas .update (
237+ self .get_volume_quota (
238+ self .app .client_manager .volume ,
239+ parsed_args ,
240+ ),
241+ )
229242
230243 result = []
231244 for resource , values in quotas .items ():
@@ -359,8 +372,7 @@ def take_action(self, parsed_args):
359372
360373 if parsed_args .volume :
361374 if parsed_args .detail :
362- LOG .warning ("Volume service doesn't provide detailed quota"
363- " information" )
375+ return self ._get_detailed_quotas (parsed_args )
364376 volume_client = self .app .client_manager .volume
365377 for p in project_ids :
366378 try :
0 commit comments