← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1676235] [NEW] IPAM inserts a port's IP allocations directly in the database, instead of appending them to the fixed_ips relationship of the port

 

Public bug reported:

When creating IPAllocation objects for a port, the IPAM inserts them
directly in the DB, establishing the one to many relationship by setting
the port_id foreign key (in IPAllocation):
https://github.com/openstack/neutron/blob/master/neutron/db/db_base_plugin_common.py#L109.

This behavior has detrimental performance consequences for the
implementation of enginefacade, where we want the following pseudo-code
behavior to take place:

def create_port():
    with session.begin():
        p = Port()
        p.fixed_ips = [IPAllocation(1), IPAlocation(2)]
    return make_port_dict(p)  # <- iterates relationships needed for API

Since the IPAM is currently inserting the IPAllocation objects directly
into the DB, the make_port_dict method triggers queries to the DB when
the fixed_ips relationship is accessed, which negatively affects the
performance of Neutron.

The approach to fix this is to re-factor the IPAM in such a way that the
SQL_Alchemy object representing the port is passed to it, instead of
just the port id. With the SQL Alchemy object, the IPAM code will add
the IPAllocations to the fixed_ips relationship of the port.

** Affects: neutron
     Importance: Undecided
     Assignee: Miguel Lavalle (minsel)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Miguel Lavalle (minsel)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1676235

Title:
  IPAM inserts a port's IP allocations directly in the database, instead
  of appending them to the fixed_ips relationship of the port

Status in neutron:
  New

Bug description:
  When creating IPAllocation objects for a port, the IPAM inserts them
  directly in the DB, establishing the one to many relationship by
  setting the port_id foreign key (in IPAllocation):
  https://github.com/openstack/neutron/blob/master/neutron/db/db_base_plugin_common.py#L109.

  This behavior has detrimental performance consequences for the
  implementation of enginefacade, where we want the following pseudo-
  code behavior to take place:

  def create_port():
      with session.begin():
          p = Port()
          p.fixed_ips = [IPAllocation(1), IPAlocation(2)]
      return make_port_dict(p)  # <- iterates relationships needed for API

  Since the IPAM is currently inserting the IPAllocation objects
  directly into the DB, the make_port_dict method triggers queries to
  the DB when the fixed_ips relationship is accessed, which negatively
  affects the performance of Neutron.

  The approach to fix this is to re-factor the IPAM in such a way that
  the SQL_Alchemy object representing the port is passed to it, instead
  of just the port id. With the SQL Alchemy object, the IPAM code will
  add the IPAllocations to the fixed_ips relationship of the port.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1676235/+subscriptions


Follow ups