From 4e613994217396a9d3223dce18a025b973bed8b0 Mon Sep 17 00:00:00 2001 From: asarfaty Date: Sun, 28 Feb 2021 10:34:35 +0200 Subject: [PATCH] V2T migration: reorder networks replay Exteernal networks should be migrated before internal ones, as a vlan router interface cannot be added to a router with no external GW Change-Id: If2c1721195c1b54c1f90510205f341e0945353f8 --- vmware_nsx/api_replay/client.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vmware_nsx/api_replay/client.py b/vmware_nsx/api_replay/client.py index 6094eed6ae..b6c8d76413 100644 --- a/vmware_nsx/api_replay/client.py +++ b/vmware_nsx/api_replay/client.py @@ -590,6 +590,19 @@ class ApiReplayClient(utils.PrepareObjectForMigration): dest_azs = self.get_dest_availablity_zones('network') total_num = len(source_networks) + + # Reorder the source networks as we need to migrate the external first + # This is mandatory as vlan networks cannot be added to a router with + # no GW + external = [] + internal = [] + for network in source_networks: + if network.get('router:external'): + external.append(network) + else: + internal.append(network) + source_networks = external + internal + LOG.info("Migrating %(nets)s networks, %(subnets)s subnets and " "%(ports)s ports", {'nets': total_num, 'subnets': len(source_subnets),