diff options
author | Mykola Yakovliev <VegasQ@gmail.com> | 2018-06-08 14:35:36 -0500 |
---|---|---|
committer | Mykola Yakovliev <myakovliev@mirantis.com> | 2018-08-31 20:08:57 +0000 |
commit | 0aefe1ccba63faa0d0e7131bbbd3331741e3ec2e (patch) | |
tree | 149881c992db3ccb370e1c1505f850ce60acb47e /neutronclient/neutron | |
parent | f0640571d1d32210c6121763e4222069e6d539f8 (diff) | |
download | python-neutronclient-0aefe1ccba63faa0d0e7131bbbd3331741e3ec2e.tar.gz |
Ensure API calls for subnets are in URL length limit
Fix situation when with pagination enabled, neutronclient failed
to read subnets information due to too long URI.
Change-Id: I53240c536d77a95510b5c83b81e21782f29d886a
Closes-Bug: 1775922
Diffstat (limited to 'neutronclient/neutron')
-rw-r--r-- | neutronclient/neutron/v2_0/network.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/neutronclient/neutron/v2_0/network.py b/neutronclient/neutron/v2_0/network.py index 3ec3ac6..6c68b62 100644 --- a/neutronclient/neutron/v2_0/network.py +++ b/neutronclient/neutron/v2_0/network.py @@ -44,6 +44,9 @@ class ListNetwork(neutronV20.ListCommand): # Length of a query filter on subnet id # id=<uuid>& (with len(uuid)=36) subnet_id_filter_len = 40 + # Length of a marker in pagination + # &marker=<uuid> (with len(uuid)=36) + marker_len = 44 resource = 'network' _formatters = {'subnets': _format_subnets, } list_columns = ['id', 'name', 'subnets'] @@ -115,6 +118,8 @@ class ListNetwork(neutronV20.ListCommand): subnet_count = len(subnet_ids) max_size = ((self.subnet_id_filter_len * subnet_count) - uri_len_exc.excess) + if self.pagination_support: + max_size -= self.marker_len chunk_size = max_size // self.subnet_id_filter_len subnets = [] for i in range(0, subnet_count, chunk_size): |