NSX-TVD: Fix md proxy internal tenant

NSX-V md proxy creates some neutron objects with an internal tenant.
For the TCD support we need this tenant to be mapped to the nsx-v
plugin

Change-Id: Iae96ef2483b97c81dc7a8e95e83a35c2ab3d0efe
This commit is contained in:
Adit Sarfaty 2017-12-17 15:29:43 +02:00
parent 792a6a0103
commit 91e7ec1823
2 changed files with 15 additions and 1 deletions

View File

@ -31,7 +31,7 @@ VDR_EDGE = 'vdr'
INTER_EDGE_PURPOSE = 'inter_edge_net' INTER_EDGE_PURPOSE = 'inter_edge_net'
# etc # etc
INTERNAL_TENANT_ID = 'a1b2c3d4-e5f6-eeff-ffee-6f5e4d3c2b1a' INTERNAL_TENANT_ID = 'metadata_internal_project'
# L2 gateway edge name prefix # L2 gateway edge name prefix
L2_GATEWAY_EDGE = 'L2 bridging' L2_GATEWAY_EDGE = 'L2 bridging'

View File

@ -20,6 +20,7 @@ import eventlet
import netaddr import netaddr
from neutron_lib import constants from neutron_lib import constants
from neutron_lib import context as neutron_context from neutron_lib import context as neutron_context
from neutron_lib.plugins import directory
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
@ -29,6 +30,7 @@ from vmware_nsx.common import locking
from vmware_nsx.common import nsxv_constants from vmware_nsx.common import nsxv_constants
from vmware_nsx.common import utils from vmware_nsx.common import utils
from vmware_nsx.db import nsxv_db from vmware_nsx.db import nsxv_db
from vmware_nsx.extensions import projectpluginmap
from vmware_nsx.plugins.nsx_v.vshield import ( from vmware_nsx.plugins.nsx_v.vshield import (
nsxv_loadbalancer as nsxv_lb) nsxv_loadbalancer as nsxv_lb)
from vmware_nsx.plugins.nsx_v.vshield.common import ( from vmware_nsx.plugins.nsx_v.vshield.common import (
@ -117,6 +119,18 @@ class NsxVMetadataProxyHandler(object):
# Init cannot run concurrently on multiple nodes # Init cannot run concurrently on multiple nodes
with locking.LockManager.get_lock('nsx-metadata-init'): with locking.LockManager.get_lock('nsx-metadata-init'):
# if the core plugin is the TVD - we need to add project
# plugin mapping for the internal project
core_plugin = directory.get_plugin()
if core_plugin.is_tvd_plugin():
try:
core_plugin.create_project_plugin_map(
context,
{'project_plugin_map':
{'plugin': projectpluginmap.NsxPlugins.NSX_T,
'project': nsxv_constants.INTERNAL_TENANT_ID}})
except projectpluginmap.ProjectPluginAlreadyExists:
pass
self.internal_net, self.internal_subnet = ( self.internal_net, self.internal_subnet = (
self._get_internal_network_and_subnet(context)) self._get_internal_network_and_subnet(context))