V2T migraion: Handle internal networks migration
In the policy plugin: do not delete migration related networks Those networks cannot simply be deleted after the migration And in the migration, update those networks name to reflect their role in the migration. Change-Id: I6864bf187e8422c4ecd954b75d8a103293805d5d
This commit is contained in:
parent
f11a91e7fa
commit
d3274ffc28
|
@ -487,7 +487,7 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
|
|||
# If its a distributed router, we may also need to create its
|
||||
# internal network
|
||||
if self.int_vni_map and router['id'] in self.int_vni_map:
|
||||
net_name = ("Internal network for distributed router %s" %
|
||||
net_name = ("Internal network for router %s migration" %
|
||||
router['id'])
|
||||
net_body = {'tenant_id': nsxv_constants.INTERNAL_TENANT_ID,
|
||||
'id': router['id'],
|
||||
|
|
|
@ -19,6 +19,7 @@ from oslo_config import cfg
|
|||
from oslo_utils import uuidutils
|
||||
import webob.exc
|
||||
|
||||
from vmware_nsx.common import nsxv_constants
|
||||
from vmware_nsxlib.v3 import nsx_constants as nsxlib_consts
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
@ -251,6 +252,11 @@ class PrepareObjectForMigration(object):
|
|||
if net_vni_map and body['id'] in net_vni_map:
|
||||
body['vni'] = net_vni_map[body['id']]
|
||||
|
||||
if (body.get('project_id') == nsxv_constants.INTERNAL_TENANT_ID and
|
||||
body.get('name').startswith('inter-edge-net')):
|
||||
# rename the internal network
|
||||
body['name'] = "Internal network for mdproxy migration"
|
||||
|
||||
return body
|
||||
|
||||
def prepare_subnet(self, subnet, direct_call=False):
|
||||
|
|
|
@ -68,6 +68,7 @@ from vmware_nsx.common import exceptions as nsx_exc
|
|||
from vmware_nsx.common import l3_rpc_agent_api
|
||||
from vmware_nsx.common import locking
|
||||
from vmware_nsx.common import managers
|
||||
from vmware_nsx.common import nsxv_constants
|
||||
from vmware_nsx.common import utils
|
||||
from vmware_nsx.db import db as nsx_db
|
||||
from vmware_nsx.extensions import api_replay
|
||||
|
@ -821,15 +822,22 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
|
|||
|
||||
return created_net
|
||||
|
||||
def _check_internal_network(self, net):
|
||||
if net.get('tenant_id') == nsxv_constants.INTERNAL_TENANT_ID:
|
||||
msg = _("This network was created during the migration for "
|
||||
"internal usage and cannot be deleted")
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
def delete_network(self, context, network_id):
|
||||
is_external_net = self._network_is_external(context, network_id)
|
||||
network = self._get_network(context, network_id)
|
||||
self._check_internal_network(network)
|
||||
|
||||
if not is_external_net:
|
||||
# First disable DHCP & delete its port
|
||||
if self.use_policy_dhcp:
|
||||
lock = 'nsxp_network_' + network_id
|
||||
with locking.LockManager.get_lock(lock):
|
||||
network = self._get_network(context, network_id)
|
||||
if not self._has_active_port(context, network_id):
|
||||
self._disable_network_dhcp(context, network)
|
||||
elif cfg.CONF.nsx_p.allow_passthrough:
|
||||
|
|
Loading…
Reference in New Issue