Comment 1 for bug 1796074

Revision history for this message
melanie witt (melwitt) wrote : Re: python-novaclient Unexpected API Error

Thanks for providing a detailed bug report complete with log excerpts. From the log, we can see that the error you're hitting is coming from the python-neutronclient code:

  RequestURITooLong: An unknown exception occurred.

Looking at the nova code where this is being emitted from nova/network/neutronv2/api.py in the _get_subnets_from_port method [1], it looks like this:

  search_opts = {'id': [ip['subnet_id'] for ip in fixed_ips]}
  data = client.list_subnets(**search_opts)

with the second line being the call to neutron. It's calling the neutron /subnets API with a list of subnet IDs per fixed IP. I think it's this API [2] with using the 'fields' request parameter, for example:

  /subnets?id=<subnet_id1>&id=<subnet_id2>&id=<subnet_id3>...

The python-neutronclient code will add all of the parameters to the query string [3].

So, because you have 250 interfaces attached to your instance, the request to neutron is too long because 250 subnet_ids are in the URI and we fail with RequestURITooLong.

Are your interfaces attached to 250 different subnets? If not, then I think in nova we could improve the code to de-dupe subnet_ids before we call neutron. Other than that, if you really needed to have 250 different subnets filtered in the neutron API, you would need to propose a change to the python-neutronclient project to send query parameters in the request body instead of in the URI as a query string.

As a test, could you try changing the line in nova/network/neutronv2/api.py from:

  search_opts = {'id': [ip['subnet_id'] for ip in fixed_ips]}

to:

  search_opts = {'id': set([ip['subnet_id'] for ip in fixed_ips])}

and see if that helps you?

[1] https://github.com/openstack/nova/blob/85b36cd2f82ccd740057c1bee08fc722209604ab/nova/network/neutronv2/api.py#L2875-L2889
[2] https://developer.openstack.org/api-ref/network/v2/index.html#list-subnets
[3] https://github.com/openstack/python-neutronclient/blob/15d99a7d68435132fd2fbd4ba604c3796802a83e/neutronclient/v2_0/client.py#L276