Merge "Fix LB drivers to have a core plugin"

This commit is contained in:
Zuul 2018-06-14 08:56:27 +00:00 committed by Gerrit Code Review
commit c9f7c18b36

View File

@ -16,6 +16,8 @@
from oslo_log import helpers as log_helpers from oslo_log import helpers as log_helpers
from neutron_lib import exceptions as n_exc from neutron_lib import exceptions as n_exc
from neutron_lib.plugins import constants as plugin_const
from neutron_lib.plugins import directory
class LBaaSNSXObjectManagerWrapper(object): class LBaaSNSXObjectManagerWrapper(object):
@ -24,6 +26,8 @@ class LBaaSNSXObjectManagerWrapper(object):
This class will call the actual NSX-V LBaaS logic after translating This class will call the actual NSX-V LBaaS logic after translating
the LB object into a dictionary, and will also handle success/failure cases the LB object into a dictionary, and will also handle success/failure cases
""" """
_core_plugin = None
@log_helpers.log_method_call @log_helpers.log_method_call
def __init__(self, object_type, implementor, translator, get_completor): def __init__(self, object_type, implementor, translator, get_completor):
super(LBaaSNSXObjectManagerWrapper, self).__init__() super(LBaaSNSXObjectManagerWrapper, self).__init__()
@ -32,6 +36,17 @@ class LBaaSNSXObjectManagerWrapper(object):
self.translator = translator self.translator = translator
self.get_completor = get_completor self.get_completor = get_completor
def _get_plugin(self, plugin_type):
return directory.get_plugin(plugin_type)
@property
def core_plugin(self):
if not self._core_plugin:
self._core_plugin = (
self._get_plugin(plugin_const.CORE))
return self._core_plugin
def get_completor_func(self, context, obj, delete=False): def get_completor_func(self, context, obj, delete=False):
# return a method that will be called on success/failure completion # return a method that will be called on success/failure completion
def completor_func(success=True): def completor_func(success=True):