neutron net-list with pagination fails on too many subnets

Bug #1775922 reported by Mykola Yakovliev
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-neutronclient
Fix Released
Undecided
Mykola Yakovliev

Bug Description

To reproduce the bug you need to have a lot of subnets:

8192 (max uri length) / 40 (length of single subnet filter) = 204 subnets

In this situation when the count of subnets is over this value, the client will try to paginate request but fails because it does not count for a marker.

for i in `seq 1 254`; do neutron net-create test-net-$i ;done
for i in `seq 1 254`; do neutron subnet-create --name test-subnet-$i test-net-$i 172.25.$i.0/24;done

During "neutron net-list" call you will get an exception:

ERROR: neutronclient.shell An unknown exception occurred.
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/neutronclient/shell.py", line 787, in run_subcommand
    return run_command(cmd, cmd_parser, sub_argv)
  File "/usr/lib/python2.7/dist-packages/neutronclient/shell.py", line 104, in run_command
    return cmd.run(known_args)
  File "/usr/lib/python2.7/dist-packages/neutronclient/common/command.py", line 29, in run
    return super(OpenStackCommand, self).run(parsed_args)
  File "/usr/lib/python2.7/dist-packages/cliff/display.py", line 91, in run
    column_names, data = self.take_action(parsed_args)
  File "/usr/lib/python2.7/dist-packages/neutronclient/common/command.py", line 35, in take_action
    return self.get_data(parsed_args)
  File "/usr/lib/python2.7/dist-packages/neutronclient/neutron/v2_0/__init__.py", line 694, in get_data
    self.extend_list(data, parsed_args)
  File "/usr/lib/python2.7/dist-packages/neutronclient/neutron/v2_0/network.py", line 87, in extend_list
    _get_subnet_list(subnet_ids[i: i + chunk_size]))
  File "/usr/lib/python2.7/dist-packages/neutronclient/neutron/v2_0/network.py", line 61, in _get_subnet_list
    **search_opts).get('subnets', [])
  File "/usr/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 96, in with_params
    ret = self.function(instance, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 589, in list_subnets
    **_params)
  File "/usr/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 301, in list
    for r in self._pagination(collection, path, **params):
  File "/usr/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 314, in _pagination
    res = self.get(path, params=params)
  File "/usr/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 287, in get
    headers=headers, params=params)
  File "/usr/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 264, in retry_request
    headers=headers, params=params)
  File "/usr/lib/python2.7/dist-packages/neutronclient/v2_0/client.py", line 194, in do_request
    content_type=self.content_type())
  File "/usr/lib/python2.7/dist-packages/neutronclient/client.py", line 305, in do_request
    self._check_uri_length(url)
  File "/usr/lib/python2.7/dist-packages/neutronclient/client.py", line 301, in _check_uri_length
    excess=uri_len - MAX_URI_LEN)
RequestURITooLong: An unknown exception occurred.

The problem happens because subnet pagination does not take in a count "&marker=uuid".

Tags: api
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-neutronclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/573821

Changed in python-neutronclient:
assignee: nobody → Mykola Yakovliev (vegasq)
status: New → In Progress
description: updated
description: updated
description: updated
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-neutronclient (master)

Reviewed: https://review.openstack.org/573821
Committed: https://git.openstack.org/cgit/openstack/python-neutronclient/commit/?id=0aefe1ccba63faa0d0e7131bbbd3331741e3ec2e
Submitter: Zuul
Branch: master

commit 0aefe1ccba63faa0d0e7131bbbd3331741e3ec2e
Author: Mykola Yakovliev <email address hidden>
Date: Fri Jun 8 14:35:36 2018 -0500

    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

Changed in python-neutronclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-neutronclient 6.10.0

This issue was fixed in the openstack/python-neutronclient 6.10.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.