← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1527049] Re: is_dvr_serviced in unbind_router_servicenode is duplicated and unnecessary

 

[Expired for neutron because there has been no activity for 60 days.]

** Changed in: neutron
       Status: Incomplete => Expired

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

Title:
  is_dvr_serviced in unbind_router_servicenode is duplicated and
  unnecessary

Status in neutron:
  Expired

Bug description:
  in method unbind_router_servicenode, it will check if there is still
  any dvr serviced port exist on node, by getting all ports on host that
  related to given router:

              for subnet in subnet_ids:
                  ports = (
                      self._core_plugin.get_ports_on_host_by_subnet(
                          context, host, subnet))
                  for port in ports:
                      if (n_utils.is_dvr_serviced(port['device_owner'])):
                          port_found = True
                          LOG.debug('One or more ports exist on the snat '
                                    'enabled l3_agent host %(host)s and '
                                    'router_id %(id)s',
                                    {'host': host, 'id': router_id})
                          break
  https://github.com/openstack/neutron/blob/master/neutron/db/l3_dvrscheduler_db.py#L293-L303

  but the logic in inner for loop here is duplicated and unnecessary, since get_ports_on_host_by_subnet will get all dvr serviced ports already, so it doesn't need to check again.
  in get_ports_on_host_by_subnet:

          for port in ports:
              device_owner = port['device_owner']
              if (utils.is_dvr_serviced(device_owner)):
                  if port[portbindings.HOST_ID] == host:
                      port_dict = self.plugin._make_port_dict(port,
                          process_extensions=False)
                      ports_by_host.append(port_dict)

  https://github.com/openstack/neutron/blob/master/neutron/db/dvr_mac_db.py#L128-L156

  ### update ###
  Per https://review.openstack.org/#/c/255374/4/neutron/db/l3_agentschedulers_db.py, only method check_ports_exist_on_l3agent(or its new version check_dvr_serviceable_ports_on_host) is necessary to be used in unbind_router_servicenode.

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


References