← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1452275] [NEW] loading multiple extension apis using a single extension driver fails

 

Public bug reported:

While trying to implement an extension driver, i observed that more than
one extension apis can not be exposed.

For Eg:

class ABCExtensionDriver(api.ExtensionDriver):

    _supported_extension_aliases = ["switch", "commit", "trunked"]

    def initialize(self):
        api_extensions.append_api_extensions_path(extensions.__path__)
        LOG.info("IronicExtensionDriver initialization complete")


    @property
    def extension_alias(self):
        if not hasattr(self, '_aliases'):
            aliases = self._supported_extension_aliases[:]
            self._aliases = aliases
        return self._aliases


The above code results in following exception:
2015-05-06 13:04:11.818 INFO neutron.plugins.ml2.managers [-] Got ['switch', 'commit', 'trunked'] extension from driver 'abc_ext_driver'
2015-05-06 13:04:11.819 DEBUG neutron.openstack.common.lockutils [-] Semaphore / lock released "_create_instance" from (pid=1546) inner /opt/stack/neutron/neutron/openstack/common/lockutils.py:252
2015-05-06 13:04:11.819 ERROR neutron.service [-] Unrecoverable error: please check log for details.
2015-05-06 13:04:11.819 TRACE neutron.service Traceback (most recent call last):
2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/service.py", line 102, in serve_wsgi
2015-05-06 13:04:11.819 TRACE neutron.service     service.start()
2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/service.py", line 73, in start
2015-05-06 13:04:11.819 TRACE neutron.service     self.wsgi_app = _run_wsgi(self.app_name)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/service.py", line 172, in _run_wsgi
2015-05-06 13:04:11.819 TRACE neutron.service     app = config.load_paste_app(app_name)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/common/config.py", line 185, in load_paste_app
2015-05-06 13:04:11.819 TRACE neutron.service     app = deploy.loadapp("config:%s" % config_path, name=app_name)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
2015-05-06 13:04:11.819 TRACE neutron.service     return loadobj(APP, uri, name=name, **kw)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
2015-05-06 13:04:11.819 TRACE neutron.service     return context.create()
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
2015-05-06 13:04:11.819 TRACE neutron.service     return self.object_type.invoke(self)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 144, in invoke
2015-05-06 13:04:11.819 TRACE neutron.service     **context.local_conf)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 58, in fix_call
2015-05-06 13:04:11.819 TRACE neutron.service     reraise(*exc_info)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/compat.py", line 23, in reraise
2015-05-06 13:04:11.819 TRACE neutron.service     exec('raise t, e, tb', dict(t=t, e=e, tb=tb))
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 55, in fix_call
2015-05-06 13:04:11.819 TRACE neutron.service     val = callable(*args, **kw)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/urlmap.py", line 28, in urlmap_factory
2015-05-06 13:04:11.819 TRACE neutron.service     app = loader.get_app(app_name, global_conf=global_conf)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 350, in get_app
2015-05-06 13:04:11.819 TRACE neutron.service     name=name, global_conf=global_conf).create()
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
2015-05-06 13:04:11.819 TRACE neutron.service     return self.object_type.invoke(self)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 144, in invoke
2015-05-06 13:04:11.819 TRACE neutron.service     **context.local_conf)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 58, in fix_call
2015-05-06 13:04:11.819 TRACE neutron.service     reraise(*exc_info)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/compat.py", line 23, in reraise
2015-05-06 13:04:11.819 TRACE neutron.service     exec('raise t, e, tb', dict(t=t, e=e, tb=tb))
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 55, in fix_call
2015-05-06 13:04:11.819 TRACE neutron.service     val = callable(*args, **kw)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/auth.py", line 71, in pipeline_factory
2015-05-06 13:04:11.819 TRACE neutron.service     app = loader.get_app(pipeline[-1])
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 350, in get_app
2015-05-06 13:04:11.819 TRACE neutron.service     name=name, global_conf=global_conf).create()
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
2015-05-06 13:04:11.819 TRACE neutron.service     return self.object_type.invoke(self)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 146, in invoke
2015-05-06 13:04:11.819 TRACE neutron.service     return fix_call(context.object, context.global_conf, **context.local_conf)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 58, in fix_call
2015-05-06 13:04:11.819 TRACE neutron.service     reraise(*exc_info)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/compat.py", line 23, in reraise
2015-05-06 13:04:11.819 TRACE neutron.service     exec('raise t, e, tb', dict(t=t, e=e, tb=tb))
2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 55, in fix_call
2015-05-06 13:04:11.819 TRACE neutron.service     val = callable(*args, **kw)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/api/v2/router.py", line 72, in factory
2015-05-06 13:04:11.819 TRACE neutron.service     return cls(**local_config)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/api/v2/router.py", line 76, in __init__
2015-05-06 13:04:11.819 TRACE neutron.service     plugin = manager.NeutronManager.get_plugin()
2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/manager.py", line 219, in get_plugin
2015-05-06 13:04:11.819 TRACE neutron.service     return weakref.proxy(cls.get_instance().plugin)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/manager.py", line 213, in get_instance
2015-05-06 13:04:11.819 TRACE neutron.service     cls._create_instance()
2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/openstack/common/lockutils.py", line 249, in inner
2015-05-06 13:04:11.819 TRACE neutron.service     return f(*args, **kwargs)
2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/manager.py", line 199, in _create_instance
2015-05-06 13:04:11.819 TRACE neutron.service     cls._instance = cls()
2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/manager.py", line 125, in __init__
2015-05-06 13:04:11.819 TRACE neutron.service     self._load_service_plugins()
2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/manager.py", line 162, in _load_service_plugins
2015-05-06 13:04:11.819 TRACE neutron.service     self._load_services_from_core_plugin()
2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/manager.py", line 149, in _load_services_from_core_plugin
2015-05-06 13:04:11.819 TRACE neutron.service     if ext_alias in constants.EXT_TO_SERVICE_MAPPING:
2015-05-06 13:04:11.819 TRACE neutron.service TypeError: unhashable type: 'list'
2015-05-06 13:04:11.819 TRACE neutron.service
2015-05-06 13:04:11.823 CRITICAL neutron [-] TypeError: unhashable type: 'list'

As pointed by irenab on irc, if I change
https://github.com/openstack/neutron/blob/master/neutron/plugins/ml2/managers.py#L755
to extend instead of append, it works.

** 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/1452275

Title:
  loading multiple extension apis using a single extension driver fails

Status in OpenStack Neutron (virtual network service):
  New

Bug description:
  While trying to implement an extension driver, i observed that more
  than one extension apis can not be exposed.

  For Eg:

  class ABCExtensionDriver(api.ExtensionDriver):

      _supported_extension_aliases = ["switch", "commit", "trunked"]

      def initialize(self):
          api_extensions.append_api_extensions_path(extensions.__path__)
          LOG.info("IronicExtensionDriver initialization complete")

  
      @property
      def extension_alias(self):
          if not hasattr(self, '_aliases'):
              aliases = self._supported_extension_aliases[:]
              self._aliases = aliases
          return self._aliases

  
  The above code results in following exception:
  2015-05-06 13:04:11.818 INFO neutron.plugins.ml2.managers [-] Got ['switch', 'commit', 'trunked'] extension from driver 'abc_ext_driver'
  2015-05-06 13:04:11.819 DEBUG neutron.openstack.common.lockutils [-] Semaphore / lock released "_create_instance" from (pid=1546) inner /opt/stack/neutron/neutron/openstack/common/lockutils.py:252
  2015-05-06 13:04:11.819 ERROR neutron.service [-] Unrecoverable error: please check log for details.
  2015-05-06 13:04:11.819 TRACE neutron.service Traceback (most recent call last):
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/service.py", line 102, in serve_wsgi
  2015-05-06 13:04:11.819 TRACE neutron.service     service.start()
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/service.py", line 73, in start
  2015-05-06 13:04:11.819 TRACE neutron.service     self.wsgi_app = _run_wsgi(self.app_name)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/service.py", line 172, in _run_wsgi
  2015-05-06 13:04:11.819 TRACE neutron.service     app = config.load_paste_app(app_name)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/common/config.py", line 185, in load_paste_app
  2015-05-06 13:04:11.819 TRACE neutron.service     app = deploy.loadapp("config:%s" % config_path, name=app_name)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
  2015-05-06 13:04:11.819 TRACE neutron.service     return loadobj(APP, uri, name=name, **kw)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
  2015-05-06 13:04:11.819 TRACE neutron.service     return context.create()
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
  2015-05-06 13:04:11.819 TRACE neutron.service     return self.object_type.invoke(self)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 144, in invoke
  2015-05-06 13:04:11.819 TRACE neutron.service     **context.local_conf)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 58, in fix_call
  2015-05-06 13:04:11.819 TRACE neutron.service     reraise(*exc_info)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/compat.py", line 23, in reraise
  2015-05-06 13:04:11.819 TRACE neutron.service     exec('raise t, e, tb', dict(t=t, e=e, tb=tb))
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 55, in fix_call
  2015-05-06 13:04:11.819 TRACE neutron.service     val = callable(*args, **kw)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/urlmap.py", line 28, in urlmap_factory
  2015-05-06 13:04:11.819 TRACE neutron.service     app = loader.get_app(app_name, global_conf=global_conf)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 350, in get_app
  2015-05-06 13:04:11.819 TRACE neutron.service     name=name, global_conf=global_conf).create()
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
  2015-05-06 13:04:11.819 TRACE neutron.service     return self.object_type.invoke(self)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 144, in invoke
  2015-05-06 13:04:11.819 TRACE neutron.service     **context.local_conf)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 58, in fix_call
  2015-05-06 13:04:11.819 TRACE neutron.service     reraise(*exc_info)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/compat.py", line 23, in reraise
  2015-05-06 13:04:11.819 TRACE neutron.service     exec('raise t, e, tb', dict(t=t, e=e, tb=tb))
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 55, in fix_call
  2015-05-06 13:04:11.819 TRACE neutron.service     val = callable(*args, **kw)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/auth.py", line 71, in pipeline_factory
  2015-05-06 13:04:11.819 TRACE neutron.service     app = loader.get_app(pipeline[-1])
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 350, in get_app
  2015-05-06 13:04:11.819 TRACE neutron.service     name=name, global_conf=global_conf).create()
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 710, in create
  2015-05-06 13:04:11.819 TRACE neutron.service     return self.object_type.invoke(self)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/loadwsgi.py", line 146, in invoke
  2015-05-06 13:04:11.819 TRACE neutron.service     return fix_call(context.object, context.global_conf, **context.local_conf)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 58, in fix_call
  2015-05-06 13:04:11.819 TRACE neutron.service     reraise(*exc_info)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/compat.py", line 23, in reraise
  2015-05-06 13:04:11.819 TRACE neutron.service     exec('raise t, e, tb', dict(t=t, e=e, tb=tb))
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/usr/lib/python2.7/dist-packages/paste/deploy/util.py", line 55, in fix_call
  2015-05-06 13:04:11.819 TRACE neutron.service     val = callable(*args, **kw)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/api/v2/router.py", line 72, in factory
  2015-05-06 13:04:11.819 TRACE neutron.service     return cls(**local_config)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/api/v2/router.py", line 76, in __init__
  2015-05-06 13:04:11.819 TRACE neutron.service     plugin = manager.NeutronManager.get_plugin()
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/manager.py", line 219, in get_plugin
  2015-05-06 13:04:11.819 TRACE neutron.service     return weakref.proxy(cls.get_instance().plugin)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/manager.py", line 213, in get_instance
  2015-05-06 13:04:11.819 TRACE neutron.service     cls._create_instance()
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/openstack/common/lockutils.py", line 249, in inner
  2015-05-06 13:04:11.819 TRACE neutron.service     return f(*args, **kwargs)
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/manager.py", line 199, in _create_instance
  2015-05-06 13:04:11.819 TRACE neutron.service     cls._instance = cls()
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/manager.py", line 125, in __init__
  2015-05-06 13:04:11.819 TRACE neutron.service     self._load_service_plugins()
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/manager.py", line 162, in _load_service_plugins
  2015-05-06 13:04:11.819 TRACE neutron.service     self._load_services_from_core_plugin()
  2015-05-06 13:04:11.819 TRACE neutron.service   File "/opt/stack/neutron/neutron/manager.py", line 149, in _load_services_from_core_plugin
  2015-05-06 13:04:11.819 TRACE neutron.service     if ext_alias in constants.EXT_TO_SERVICE_MAPPING:
  2015-05-06 13:04:11.819 TRACE neutron.service TypeError: unhashable type: 'list'
  2015-05-06 13:04:11.819 TRACE neutron.service
  2015-05-06 13:04:11.823 CRITICAL neutron [-] TypeError: unhashable type: 'list'

  As pointed by irenab on irc, if I change
  https://github.com/openstack/neutron/blob/master/neutron/plugins/ml2/managers.py#L755
  to extend instead of append, it works.

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


Follow ups

References