When neutron configured with, in regular devstack job it Fails to create several networks in regular tempest run.
iniset /etc/neutron/neutron.conf DEFAULT api_workers 4
http://logs.openstack.org/82/140482/2/check/check-tempest-dsvm-neutron-full/95aea86/logs/screen-q-svc.txt.gz?#_2015-01-14_13_56_07_268
2015-01-14 13:56:07.267 2814 WARNING neutron.plugins.ml2.drivers.helpers [req-f6402b6d-de49-4675-a766-b45a6bc99061 None] Allocate vxlan segment from pool failed after 10 failed attempts
2015-01-14 13:56:07.268 2814 ERROR neutron.api.v2.resource [req-f6402b6d-de49-4675-a766-b45a6bc99061 None] create failed
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource Traceback (most recent call last):
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/api/v2/resource.py", line 83, in resource
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource result = method(request=request, **args)
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/api/v2/base.py", line 451, in create
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource obj = obj_creator(request.context, **kwargs)
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/plugins/ml2/plugin.py", line 502, in create_network
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource tenant_id)
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/plugins/ml2/managers.py", line 161, in create_network_segments
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource segment = self.allocate_tenant_segment(session)
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/plugins/ml2/managers.py", line 190, in allocate_tenant_segment
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource segment = driver.obj.allocate_tenant_segment(session)
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/plugins/ml2/drivers/type_tunnel.py", line 150, in allocate_tenant_segment
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource alloc = self.allocate_partially_specified_segment(session)
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource File "/opt/stack/new/neutron/neutron/plugins/ml2/drivers/helpers.py", line 144, in allocate_partially_specified_segment
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource raise exc.NoNetworkFoundInMaximumAllowedAttempts()
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource NoNetworkFoundInMaximumAllowedAttempts: Unable to create the network. No available network found in maximum allowed attempts.
2015-01-14 13:56:07.268 2814 TRACE neutron.api.v2.resource
vxlan_vni': 1008L is successfully allocated on behalf of pid=2813 , req-f3866173-7766-46fc-9dea-e5387be7190d.
pid=2814,req-f6402b6d-de49-4675-a766-b45a6bc99061 tries to allocate the same VNI for 10 times without success.
https:/ /github. com/openstack/ neutron/ blob/3f44c9e278 74511f05e2338c1 0e836361776ed88 /neutron/ plugins/ ml2/drivers/ helpers. py#L113 issued on the same database snapshot therefore it will select the same value (Repeatable Read) .
It is possible to create new session for each select outside to the current session/ transaction.
(IMHO the VNI allocation should not be given up unless the select does not founds any VNI, I would suggest to do more than 10 try, otherwise allocation issues could be triggered with higher load and worker number.)