No tenant network is available for allocation.
Hi, all.
I got the following error while creating a tenant network.
controller > neutron --debug net-create demo
2015-11-04 14:31:16.142 20175 ERROR neutron.api.v2.resource [req-5643f2bc-3e99-4175-a0fa-b2e74659747a ] create failed
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource Traceback (most recent call last):
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/api/v2/resource.py", line 83, in resource
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource result = method(request=request, **args)
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/api/v2/base.py", line 466, in create
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource obj = obj_creator(request.context, **kwargs)
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/plugins/ml2/plugin.py", line 613, in create_network
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource network)
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/oslo_db/api.py", line 131, in wrapper
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource return f(*args, **kwargs)
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/plugins/ml2/plugin.py", line 609, in _create_network_with_retries
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource return self._create_network_db(context, network)
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/plugins/ml2/plugin.py", line 593, in _create_network_db
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource tenant_id)
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/plugins/ml2/managers.py", line 181, in create_network_segments
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource segment = self.allocate_tenant_segment(session)
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource File "/usr/lib/python2.6/site-packages/neutron/plugins/ml2/managers.py", line 216, in allocate_tenant_segment
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource raise exc.NoNetworkAvailable()
2015-11-04 14:31:16.142 20175 TRACE neutron.api.v2.resource NoNetworkAvailable: Unable to create the network. No tenant network is available for allocation.
After diving into the code, I found the cause of that error is that the records of unallocated vxlan vni in ml2_vxlan_allocations are all deleted by some unknown procedure.
mysql> select * from ml2_vxlan_allocations where allocated = 0;
Empty set (0.00 sec)
But, I can't find any procedure doing that operation. Any help is really appereciated.
BTW. My ml2_conf.ini likes this:
[ml2]
type_drivers=vxlan
tenant_network_types=vxlan
mechanism_drivers=openvswitch
[ml2_type_flat]
[ml2_type_vlan]
[ml2_type_gre]
tunnel_id_ranges=1:10000
[ml2_type_vxlan]
vni_ranges=10:10000
vxlan_group=224.0.0.1
[securitygroup]
enable_security_group=True
enable_ipset=True
firewall_driver=neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver