← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1484322] Re: Loads service plugins fault-tolerantly

 

** Changed in: neutron
       Status: In Progress => Won't Fix

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

Title:
  Loads service plugins fault-tolerantly

Status in neutron:
  Won't Fix

Bug description:
  I notice the following code can be optimized:

      def _load_service_plugins(self):
          """Loads service plugins.

          Starts from the core plugin and checks if it supports
          advanced services then loads classes provided in configuration.
          """
          # load services from the core plugin first
          self._load_services_from_core_plugin()

          plugin_providers = cfg.CONF.service_plugins
          LOG.debug("Loading service plugins: %s", plugin_providers)
          for provider in plugin_providers:
              if provider == '':
                  continue

              LOG.info(_LI("Loading Plugin: %s"), provider)
              plugin_inst = self._get_plugin_instance('neutron.service_plugins',
                                                      provider)

              # only one implementation of svc_type allowed
              # specifying more than one plugin
              # for the same type is a fatal exception
              if plugin_inst.get_plugin_type() in self.service_plugins:
                  raise ValueError(_("Multiple plugins for service "
                                     "%s were configured") %
                                   plugin_inst.get_plugin_type())

  if  provider == '' we can pass the mistake  to configure neutron service more fault-tolerant.
  who not that if plugin_inst.get_plugin_type() in self.service_plugins can be pass.
  if someone make a mistake to configure the same plugin twice,we can pass the second plugin quiet.
  so I think the following change will be better:

              if plugin_inst.get_plugin_type() in self.service_plugins:
                  continue

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


References