Merge "NSX: replace strong references to the plugin with weakref ones"

This commit is contained in:
Jenkins 2014-06-01 21:54:02 +00:00 committed by Gerrit Code Review
commit 678a9e2ef9
3 changed files with 14 additions and 10 deletions

View File

@ -86,10 +86,11 @@ class DhcpMetadataAccess(object):
nsx_svc.register_dhcp_opts(cfg)
nsx_svc.register_metadata_opts(cfg)
lsnmanager.register_lsn_opts(cfg)
lsn_manager = lsnmanager.PersistentLsnManager(self)
lsn_manager = lsnmanager.PersistentLsnManager(self.safe_reference)
self.lsn_manager = lsn_manager
if cfg.CONF.NSX.agent_mode == config.AgentModes.AGENTLESS:
notifier = nsx_svc.DhcpAgentNotifyAPI(self, lsn_manager)
notifier = nsx_svc.DhcpAgentNotifyAPI(self.safe_reference,
lsn_manager)
self.agent_notifiers[const.AGENT_TYPE_DHCP] = notifier
# In agentless mode, ports whose owner is DHCP need to
# be special cased; so add it to the list of special
@ -101,11 +102,13 @@ class DhcpMetadataAccess(object):
# are handled by Logical Services Nodes in NSX
cfg.CONF.set_override('network_auto_schedule', False)
LOG.warn(_('network_auto_schedule has been disabled'))
notifier = combined.DhcpAgentNotifyAPI(self, lsn_manager)
notifier = combined.DhcpAgentNotifyAPI(self.safe_reference,
lsn_manager)
self.supported_extension_aliases.append(lsn.EXT_ALIAS)
# Add the capability to migrate dhcp and metadata services over
self.migration_manager = (
migration.MigrationManager(self, lsn_manager, notifier))
migration.MigrationManager(
self.safe_reference, lsn_manager, notifier))
return notifier
def _init_extensions(self):
@ -141,17 +144,18 @@ class DhcpMetadataAccess(object):
return {'network': network_id, 'report': r}
def handle_network_dhcp_access(self, context, network, action):
self.handle_network_dhcp_access_delegate(self, context,
self.handle_network_dhcp_access_delegate(self.safe_reference, context,
network, action)
def handle_port_dhcp_access(self, context, port_data, action):
self.handle_port_dhcp_access_delegate(self, context, port_data, action)
self.handle_port_dhcp_access_delegate(self.safe_reference, context,
port_data, action)
def handle_port_metadata_access(self, context, port, is_delete=False):
self.handle_port_metadata_access_delegate(self, context,
self.handle_port_metadata_access_delegate(self.safe_reference, context,
port, is_delete)
def handle_router_metadata_access(self, context,
router_id, interface=None):
self.handle_metadata_access_delegate(self, context,
self.handle_metadata_access_delegate(self.safe_reference, context,
router_id, interface)

View File

@ -173,7 +173,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
self._is_default_net_gw_in_sync = False
# Create a synchronizer instance for backend sync
self._synchronizer = sync.NsxSynchronizer(
self, self.cluster,
self.safe_reference, self.cluster,
self.nsx_sync_opts.state_sync_interval,
self.nsx_sync_opts.min_sync_req_delay,
self.nsx_sync_opts.min_chunk_size,

View File

@ -109,7 +109,7 @@ class NsxAdvancedPlugin(sr_db.ServiceRouter_mixin,
# cache router type based on router id
self._router_type = {}
self.callbacks = VcnsCallbacks(self)
self.callbacks = VcnsCallbacks(self.safe_reference)
# load the vCNS driver
self._load_vcns_drivers()