← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1514068] [NEW] internal subnet case no need to repeatedly create IPDevice in _update_arp_entry

 

Public bug reported:

_update_arp_entry will create IPDevice to do arp task:
https://github.com/openstack/neutron/blob/master/neutron/agent/l3/dvr_local_router.py#L200-L227
    def _update_arp_entry(self, ip, mac, subnet_id, operation):
        """Add or delete arp entry into router namespace for the subnet."""
        port = self._get_internal_port(subnet_id)
        # update arp entry only if the subnet is attached to the router
        if not port:
            return False

        try:
            # TODO(mrsmith): optimize the calls below for bulk calls
            interface_name = self.get_internal_device_name(port['id'])
            device = ip_lib.IPDevice(interface_name, namespace=self.ns_name)

and methods _process_arp_cache_for_internal_port and _set_subnet_arp_info will call _update_arp_entry in their for loop based on arp_entry/port. Per arp_entry/port is going to be processed, an IPDevice object(same device in namespace) will be created. It's not necessary to do that.
https://github.com/openstack/neutron/blob/master/neutron/agent/l3/dvr_local_router.py#L174-L182
https://github.com/openstack/neutron/blob/master/neutron/agent/l3/dvr_local_router.py#L229-L241

We can create that IPDevice object before code enter the for loop, and
pass it to _update_arp_entry

** Affects: neutron
     Importance: Undecided
     Assignee: ZongKai LI (lzklibj)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => ZongKai LI (lzklibj)

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

Title:
  internal subnet case no need to repeatedly create IPDevice in
  _update_arp_entry

Status in neutron:
  New

Bug description:
  _update_arp_entry will create IPDevice to do arp task:
  https://github.com/openstack/neutron/blob/master/neutron/agent/l3/dvr_local_router.py#L200-L227
      def _update_arp_entry(self, ip, mac, subnet_id, operation):
          """Add or delete arp entry into router namespace for the subnet."""
          port = self._get_internal_port(subnet_id)
          # update arp entry only if the subnet is attached to the router
          if not port:
              return False

          try:
              # TODO(mrsmith): optimize the calls below for bulk calls
              interface_name = self.get_internal_device_name(port['id'])
              device = ip_lib.IPDevice(interface_name, namespace=self.ns_name)

  and methods _process_arp_cache_for_internal_port and _set_subnet_arp_info will call _update_arp_entry in their for loop based on arp_entry/port. Per arp_entry/port is going to be processed, an IPDevice object(same device in namespace) will be created. It's not necessary to do that.
  https://github.com/openstack/neutron/blob/master/neutron/agent/l3/dvr_local_router.py#L174-L182
  https://github.com/openstack/neutron/blob/master/neutron/agent/l3/dvr_local_router.py#L229-L241

  We can create that IPDevice object before code enter the for loop, and
  pass it to _update_arp_entry

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


Follow ups