← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1447034] [NEW] DVR: floating IPs not working if initially associated with non-binded port

 

Public bug reported:

Floating agent gw port is only created for compute host when floating ip is associated with a VM resided on this host [1].
If associate neutron port with floating ip before booting a VM with that port, floating agent gw port won't be created (in case this is the first VM scheduled to a compute host).
In that case l3 agent on compute host will receive router info with floating ip but no floating agent gw port: it will subscribe the router for fip namespace [2] but namespace itself won't be created [3]:
 [dvr_router.py]

    def create_dvr_fip_interfaces(self, ex_gw_port):
        floating_ips = self.get_floating_ips()
        fip_agent_port = self.get_floating_agent_gw_interface(
            ex_gw_port['network_id'])
        LOG.debug("FloatingIP agent gateway port received from the plugin: "
                  "%s", fip_agent_port)
        if floating_ips:
            is_first = self.fip_ns.subscribe(self.router_id)
            if is_first and fip_agent_port:
                if 'subnets' not in fip_agent_port:
                    LOG.error(_LE('Missing subnet/agent_gateway_port'))
                else:
                    self.fip_ns.create_gateway_port(fip_agent_port)
        ...  


Since l3 agent already subscribed the router for fip_ns it won't ever
create fip namespace for that router - this results in floating ips not
working anymore for ANY subsequent VMs on that compute host, no matter
if floating ip was associated with a VM or with a non-binded port (later
associated with a VM).

I see two possible fixes:
 - add callback for PORT UDATE event to dvr server code to react on port with floating ip being associated with a VM.
This seems not optimal given lots of checks needed in the callback which will be called fairly often.

 - l3 agent on a compute host should request floating agent gw creation
by rpc in case it receives router info with floating ips but no floating
agent gateway. There is already such a method in agent to plugin rpc
interface which now seems not used anywhere except tests. I'm not seeing
any cons here so that's what I'm going to propose.

[1] https://github.com/openstack/neutron/blob/master/neutron/db/l3_dvr_db.py#L214-L225
[2] https://github.com/openstack/neutron/blob/master/neutron/agent/l3/dvr_router.py#L502
[3] https://github.com/openstack/neutron/blob/master/neutron/agent/l3/dvr_router.py#L503-L507

** Affects: neutron
     Importance: High
     Assignee: Oleg Bondarev (obondarev)
         Status: New


** Tags: kilo-backport-potential l3-dvr-backlog

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

Title:
  DVR: floating IPs not working if initially associated with non-binded
  port

Status in OpenStack Neutron (virtual network service):
  New

Bug description:
  Floating agent gw port is only created for compute host when floating ip is associated with a VM resided on this host [1].
  If associate neutron port with floating ip before booting a VM with that port, floating agent gw port won't be created (in case this is the first VM scheduled to a compute host).
  In that case l3 agent on compute host will receive router info with floating ip but no floating agent gw port: it will subscribe the router for fip namespace [2] but namespace itself won't be created [3]:
   [dvr_router.py]

      def create_dvr_fip_interfaces(self, ex_gw_port):
          floating_ips = self.get_floating_ips()
          fip_agent_port = self.get_floating_agent_gw_interface(
              ex_gw_port['network_id'])
          LOG.debug("FloatingIP agent gateway port received from the plugin: "
                    "%s", fip_agent_port)
          if floating_ips:
              is_first = self.fip_ns.subscribe(self.router_id)
              if is_first and fip_agent_port:
                  if 'subnets' not in fip_agent_port:
                      LOG.error(_LE('Missing subnet/agent_gateway_port'))
                  else:
                      self.fip_ns.create_gateway_port(fip_agent_port)
          ...  


  Since l3 agent already subscribed the router for fip_ns it won't ever
  create fip namespace for that router - this results in floating ips
  not working anymore for ANY subsequent VMs on that compute host, no
  matter if floating ip was associated with a VM or with a non-binded
  port (later associated with a VM).

  I see two possible fixes:
   - add callback for PORT UDATE event to dvr server code to react on port with floating ip being associated with a VM.
  This seems not optimal given lots of checks needed in the callback which will be called fairly often.

   - l3 agent on a compute host should request floating agent gw
  creation by rpc in case it receives router info with floating ips but
  no floating agent gateway. There is already such a method in agent to
  plugin rpc interface which now seems not used anywhere except tests.
  I'm not seeing any cons here so that's what I'm going to propose.

  [1] https://github.com/openstack/neutron/blob/master/neutron/db/l3_dvr_db.py#L214-L225
  [2] https://github.com/openstack/neutron/blob/master/neutron/agent/l3/dvr_router.py#L502
  [3] https://github.com/openstack/neutron/blob/master/neutron/agent/l3/dvr_router.py#L503-L507

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


Follow ups

References