[neutron][ipam] how is the first subnet determined by neutron?

Slawek Kaplonski skaplons at redhat.com
Thu Feb 25 08:02:54 UTC 2021


Hi,

Dnia środa, 24 lutego 2021 23:14:33 CET Tony Liu pisze:
> Hi,
> 
> When there are multiple subnets in a provider network, FIP is always
> allocated from the "first" subnet. What I see is that, the "first" subnet
> is the subnet added as the first. Or the first subnet from "openstack
> network show".
> Is that how subnets ordered, by creation order?
> 
> Is there any way to change this order by manipulating, like subnets table in
> DB?
> 
> I have two subnets, I want to allocate FIP from the second subnet, instead
> of the first, without clean them up and recreate them. Is that possible?
> Note, not allocate specific address, but auto allocation.
> 
> 
> Thanks!
> Tony

Subnets are taken from db here [1]. As You can see in [2] the only priority 
which is given to some of them is when subnet has got service_type configured.
All other subnets don't have any determined order. They are in the order how 
they come from the DB.

If You need to create one FIP with IP from specific subnet You can do it e.g. 
with command like:

openstack floating ip create --subnet <subnet-id> <network>

[1] https://github.com/openstack/neutron/blob/
084fa99874e882649aa6895941fa913b2b852868/neutron/db/
ipam_pluggable_backend.py#L234
[2] https://github.com/openstack/neutron/blob/
084fa99874e882649aa6895941fa913b2b852868/neutron/db/ipam_backend_mixin.py#L691

-- 
Slawek Kaplonski
Principal Software Engineer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20210225/b8faa912/attachment.sig>


More information about the openstack-discuss mailing list