[openstack-dev] [Neutron] Segments, subnet types, and IPAM

Neil Jerram Neil.Jerram at metaswitch.com
Wed Mar 30 16:15:13 UTC 2016


On 29/03/16 21:55, Carl Baldwin wrote:
>
> I thought of another type of grouping which could benefit pluggable
> IPAM today.  It occurred to me as I was refreshing my memory on how
> pluggable IPAM works when there are multiple subnets on a network.
> Currently, Neutron's backend pulls the subnets  and then tries to ask
> the IPAM driver for an IP on each one in turn [1].  This is
> inefficient and I think it is a natural opportunity to evolve the IPAM
> interface to allow this to be handled within the driver itself.  The
> driver could optimize it to avoid repeated round-trips to an external
> server.

Yes, that sounds sensible.  It would be nice to continue supporting the 
current pattern too though.

> Anyway, it occurred to me that this is just like segment aware IPAM
> except that the network is the group instead of the segment.  The IPAM
> driver could consider it another orthogonal grouping of subnets (even
> though it isn't really orthogonal to Neutron's point of view).  I
> could provide an implementation that would provide a shim for existing
> IPAM drivers to work without modification.  In fact, I could do that
> for all the types of grouping I've mentioned.

Yes - I think this is the same as I've been saying in previous replies, 
i.e. that the Neutron core can filter the subnets before it offers them 
to the driver.  Is that what you meant too?

 > Drivers could choose to
> sub-class the behavior to optimize it if they have the capability.
>
> Carl
>
> [1] https://github.com/openstack/neutron/blob/4a6d05e410/neutron/db/ipam_pluggable_backend.py#L88

While we're here...

     def _ipam_try_allocate_ip(self, context, ipam_driver, port, ip_dict):
         factory = ipam_driver.get_address_request_factory()
         ip_request = factory.get_request(context, port, ip_dict)
         ipam_subnet = ipam_driver.get_subnet(ip_dict['subnet_id'])
         return ipam_subnet.allocate(ip_request)

What is the benefit of the separate "ipam_subnet = " line?  Why not just:

     def _ipam_try_allocate_ip(self, context, ipam_driver, port, ip_dict):
         factory = ipam_driver.get_address_request_factory()
         ip_request = factory.get_request(context, port, ip_dict)
         return ipam_driver.allocate(ip_request)

Similarly, what is the benefit of calling the driver twice to convert 
from (available info) to (request object) and then from (request object) 
to (IP allocation)?  Why not go directly from (available info) to (IP 
allocation)?

Finally, while I'm asking IPAM interface questions, what are subnet 
requests for?

	Neil




More information about the OpenStack-dev mailing list