[openstack-dev] [neutron] Update_port can not remove allocation from auto-addressed subnets

Carl Baldwin carl at ecbaldwin.net
Fri May 20 16:41:25 UTC 2016

On Fri, May 20, 2016 at 6:06 AM, Pavel Bondar <pbondar at infoblox.com> wrote:
> Hi,
> Currently using update_port workflow user can not remove ip addresses from
> auto-addressed subnets (SLAAC). It prevents me from implementing complete
> fix for [1].
> Typically for removing ip address from port, 'fixed_ips' list is updated and
> ip address is cleaned up from it.
> But for auto-addressed subnets if ip address is removed from 'fixed_ips',
> port_update is called, but SLAAC ip are not removed because of [2].
> This area was significantly reworked during liberty, but the same
> behavior is
> preserved at least from kilo [3].
> To make subnet deletion to comply with IPAM interface [1] any ip address
> deallocation has to be done via ipam interface (update_port), but
> update_port
> currently skips deallocation of SLAAC addresses.

Just reiterating:  This is tough because the subnet is not yet
deleted, it is about to be deleted.  So, update port doesn't know that
it should release the IPs because the subnet is going away.  It thinks
it should keep them because of the policy for each port to have an IP
on all auto-address subnets.

I also thought of calling IPAM directly from the delete subnet code.
However, this could be problematic because we really want this to go
through the update port code path so that the port is properly updated
with the new set of addresses.  I have a feeling that the port update
path might just reallocate the address for the subnet because of the
same policy.

> So I am looking for advice about a way to allow deallocation of SLAAC
> addresses via update_port.
> I see several possible solutions, but they are not ideal, so please let
> me know
> if you see a better solution:
> - Add additional parameter like 'allow_slaac_deletion' to update_port
> method,
> and pass it through
> update_port->update_port_with_ips->_update_ips_for_port->
> _get_changed_ips_for_port to alternate behavior in [2]. It involves changing
> parameters for API exposed method update_port, so not sure if it can be
> accepted.
> - Another way is to introduce new state for 'fixed_ips' list. Currently
> it can
> have 'subnet_id' and 'ip_address' as keys. We could add new key like
> 'delete_subnet_id' to force delete allocations for slaac subnets. This way
> there is no need to update parameters for bunch of methods.

I guess I prefer something like the latter:  an attribute in fixed ips
communicating that certain auto-address subnets are going away and
their addresses should be deallocated.  Maybe someone else will have
another idea.  I can't think of anything better yet.


> Please share your thoughts about the ways to fix it.
> [1] https://bugs.launchpad.net/neutron/+bug/1564335
> [2]
> https://github.com/openstack/neutron/blob/f494de47fcef7776f7d29d5ceb2cc4db96bd1efd/neutron/db/ipam_backend_mixin.py#L435
> [3]
> https://github.com/openstack/neutron/blob/stable/kilo/neutron/db/db_base_plugin_v2.py#L444

More information about the OpenStack-dev mailing list