@profiler.trace
def list_resources_with_long_filters(list_method, filter_attr, filter_values, **params):
 try:
  params[filter_attr] = filter_values
  return list_method(**params)
 except neutron_exc.RequestURITooLong as uri_len_exc:
  if (type(filter_values) != list):
   filter_values = [filter_values]
  all_filter_len = sum((((len(filter_attr) + len(val)) + 2) for val in filter_values))
  allowed_filter_len = (all_filter_len - uri_len_exc.excess)
  val_maxlen = max((len(val) for val in filter_values))
  filter_maxlen = ((len(filter_attr) + val_maxlen) + 2)
  chunk_size = (allowed_filter_len // filter_maxlen)
  resources = []
  for i in range(0, len(filter_values), chunk_size):
   params[filter_attr] = filter_values[i:(i + chunk_size)]
   resources.extend(list_method(**params))
  return resources

@ profiler . trace def list_resources_with_long_filters ( list_method , filter_attr , filter_values , ** params ) : try : params [ filter_attr ] = filter_values return list_method ( ** params ) except neutron_exc . RequestURITooLong as uri_len_exc : if ( type ( filter_values ) != list ) : filter_values = [ filter_values ] all_filter_len = sum ( ( ( ( len ( filter_attr ) + len ( val ) ) + 2 ) for val in filter_values ) ) allowed_filter_len = ( all_filter_len - uri_len_exc . excess ) val_maxlen = max ( ( len ( val ) for val in filter_values ) ) filter_maxlen = ( ( len ( filter_attr ) + val_maxlen ) + 2 ) chunk_size = ( allowed_filter_len // filter_maxlen ) resources = [ ] for i in range ( 0 , len ( filter_values ) , chunk_size ) : params [ filter_attr ] = filter_values [ i : ( i + chunk_size ) ] resources . extend ( list_method ( ** params ) ) return resources
list neutron resources with handling requesturitoolong exception .