TVD: move plugins init_complete code to the end of init
If the nsx-v/v3 init fails, the registration to init_complete should not be done, since the init_complete method might fail too. Change-Id: I2b9550394f67f4dfb79dba9455f2d75af5d28802
This commit is contained in:
parent
45ccd1eaa3
commit
bbf48e9c69
@ -223,6 +223,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
floatingip=l3_db_models.FloatingIP)
|
||||
def __init__(self):
|
||||
self._is_sub_plugin = tvd_utils.is_tvd_core_plugin()
|
||||
self.init_is_complete = False
|
||||
self.housekeeper = None
|
||||
super(NsxVPluginV2, self).__init__()
|
||||
if self._is_sub_plugin:
|
||||
@ -233,10 +234,6 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
extension_drivers=extension_drivers)
|
||||
# Bind the dummy L3 notifications
|
||||
self.l3_rpc_notifier = l3_rpc_agent_api.L3NotifyAPI()
|
||||
self.init_is_complete = False
|
||||
registry.subscribe(self.init_complete,
|
||||
resources.PROCESS,
|
||||
events.AFTER_INIT)
|
||||
self._extension_manager.initialize()
|
||||
self.supported_extension_aliases.extend(
|
||||
self._extension_manager.extension_aliases())
|
||||
@ -323,6 +320,12 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
# Bind QoS notifications
|
||||
qos_driver.register(self)
|
||||
|
||||
# subscribe the init complete method last, so it will be called only
|
||||
# if init was successful
|
||||
registry.subscribe(self.init_complete,
|
||||
resources.PROCESS,
|
||||
events.AFTER_INIT)
|
||||
|
||||
@staticmethod
|
||||
def plugin_type():
|
||||
return projectpluginmap.NsxPlugins.NSX_V
|
||||
|
@ -214,6 +214,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
||||
floatingip=l3_db_models.FloatingIP)
|
||||
def __init__(self):
|
||||
self._is_sub_plugin = tvd_utils.is_tvd_core_plugin()
|
||||
self.init_is_complete = False
|
||||
nsxlib_utils.set_is_attr_callback(validators.is_attr_set)
|
||||
self._extend_fault_map()
|
||||
if self._is_sub_plugin:
|
||||
@ -271,11 +272,6 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
||||
# init profiles on nsx backend
|
||||
self._init_nsx_profiles()
|
||||
|
||||
self.init_is_complete = False
|
||||
registry.subscribe(self.init_complete,
|
||||
resources.PROCESS,
|
||||
events.AFTER_INIT)
|
||||
|
||||
# Include exclude NSGroup
|
||||
LOG.debug("Initializing NSX v3 Excluded Port NSGroup")
|
||||
self._excluded_port_nsgroup = None
|
||||
@ -307,6 +303,12 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
||||
# Register NSXv3 trunk driver to support trunk extensions
|
||||
self.trunk_driver = trunk_driver.NsxV3TrunkDriver.create(self)
|
||||
|
||||
# subscribe the init complete method last, so it will be called only
|
||||
# if init was successful
|
||||
registry.subscribe(self.init_complete,
|
||||
resources.PROCESS,
|
||||
events.AFTER_INIT)
|
||||
|
||||
@staticmethod
|
||||
def plugin_type():
|
||||
return projectpluginmap.NsxPlugins.NSX_T
|
||||
|
Loading…
x
Reference in New Issue
Block a user