← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1508789] [NEW] Linux bridge agent "get_bridge_for_tap_device" can be optimized

 

Public bug reported:

Currently,  when lb agent need to get bridge for a tap device,  it will
iterate all the bridges and all the tap devices on each bridge to check
which bridge the tap device bound to . It takes too much time.  code:

https://github.com/openstack/neutron/blob/master/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py#L210-L217

One better way should to  check it from tap device itself.   If tap
device bound to a bridge, there should has a link named "master" from
bridge folder to tap folder "/sys/class/net/tapxxx".   So we can check
the BRIDGEFS to get the related bridge.

One prototype of this change:

    def get_bridge_for_tap_device(self, tap_device_name):
        tap_master = BRIDGE_FS + tap_device_name + '/master'
        if os.path.islink(tap_master)
            return os.readlink(tap_master).split('/')[1]

** Affects: neutron
     Importance: Undecided
         Status: New

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

Title:
  Linux bridge agent "get_bridge_for_tap_device" can be optimized

Status in neutron:
  New

Bug description:
  Currently,  when lb agent need to get bridge for a tap device,  it
  will iterate all the bridges and all the tap devices on each bridge to
  check which bridge the tap device bound to . It takes too much time.
  code:

  https://github.com/openstack/neutron/blob/master/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py#L210-L217

  One better way should to  check it from tap device itself.   If tap
  device bound to a bridge, there should has a link named "master" from
  bridge folder to tap folder "/sys/class/net/tapxxx".   So we can check
  the BRIDGEFS to get the related bridge.

  One prototype of this change:

      def get_bridge_for_tap_device(self, tap_device_name):
          tap_master = BRIDGE_FS + tap_device_name + '/master'
          if os.path.islink(tap_master)
              return os.readlink(tap_master).split('/')[1]

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


Follow ups