def _parse_class_args(self):
"""Parse the contrailplugin.ini file.
Opencontrail supports extension such as ipam, policy, these extensions
can be configured in the plugin configuration file as shown below.
Plugin then loads the specified extensions.
contrail_extensions=ipam:<classpath>,policy:<classpath>
"""
contrail_extensions = cfg.CONF.APISERVER.contrail_extensions
# If multiple class specified for same extension, last one will win
# according to DictOpt behavior
for ext_name, ext_class in contrail_extensions.items():
try:
if not ext_class or ext_class == 'None':
self.supported_extension_aliases.append(ext_name)
continue
ext_class = importutils.import_class(ext_class)
ext_instance = ext_class()
ext_instance.set_core(self)
for method in dir(ext_instance):
for prefix in ['get', 'update', 'delete', 'create']:
if method.startswith('%s_' % prefix):
setattr(self, method,
ext_instance.__getattribute__(method))
self.supported_extension_aliases.append(ext_name)
except Exception:
LOG.exception("Contrail Backend Error")
# Converting contrail backend error to Neutron Exception
raise exceptions.InvalidContrailExtensionError(
ext_name=ext_name, ext_class=ext_class)
self._build_auth_details()
contrail_driver_base.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录