[V2T][Admin utils] Exit with error if ext network not found

The command for validating external CIDR should not ignore the
case where T0 mappings for some external network are not
specified, but rather raise an error.

Change-Id: Ic3f8628e28e91a0486c9c1370b701d7625905f33
This commit is contained in:
Salvatore Orlando 2021-07-09 04:12:21 -07:00
parent 73bf4bbe31
commit 769fdc6469

View File

@ -198,8 +198,10 @@ def migration_validate_external_cidrs(resource, event, trigger, **kwargs):
net_cidr = netaddr.IPNetwork(external_cidrs[net_id]).cidr
tier0 = external_networks.get(net_id)
if not tier0:
LOG.warning("Could not find network %s in %s",
net_id, ext_net_file)
LOG.error("Could not find network %s in %s. Please ensure "
"external networks are correctly listed in "
"migrator configuration ", net_id, ext_net_file)
sys.exit(1)
else:
tier0_cidrs = nsxpolicy.tier0.get_uplink_cidrs(tier0)
for cidr in tier0_cidrs: