Public bug reported:

In many L3 plugins, there is a reference needed to the L3 core plugin.
This is typically done as:

        plugin =
manager.NeutronManager.get_service_plugins().get(constants.L3_ROUTER_NAT)

Rather than looking up the plugin, each time it is needed (e.g.
processing each VPN API request), this bug proposes to do a lazy init of
the plugin as in:

    @property
    def l3_plugin(self):
        try:
            return self._l3_plugin
        except AttributeError:
            self._l3_plugin = manager.NeutronManager.get_service_plugins().get(
                constants.L3_ROUTER_NAT)
            return self._l3_plugin

In addition, we can look at placing this in a common area (mixin?) or as
a decorator, so that each class that needs it could use the mixin,
rather than repeat this property.

** Affects: neutron
     Importance: Undecided
     Assignee: Paul Michali (pcm)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Paul Michali (pcm)

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

Title:
  Use lazy init for L3 plugin reference

Status in OpenStack Neutron (virtual network service):
  New

Bug description:
  In many L3 plugins, there is a reference needed to the L3 core plugin.
  This is typically done as:

          plugin =
  manager.NeutronManager.get_service_plugins().get(constants.L3_ROUTER_NAT)

  Rather than looking up the plugin, each time it is needed (e.g.
  processing each VPN API request), this bug proposes to do a lazy init
  of the plugin as in:

      @property
      def l3_plugin(self):
          try:
              return self._l3_plugin
          except AttributeError:
              self._l3_plugin = 
manager.NeutronManager.get_service_plugins().get(
                  constants.L3_ROUTER_NAT)
              return self._l3_plugin

  In addition, we can look at placing this in a common area (mixin?) or
  as a decorator, so that each class that needs it could use the mixin,
  rather than repeat this property.

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

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to