diff --git a/vmware_nsx/common/nsxv_constants.py b/vmware_nsx/common/nsxv_constants.py index 1975893e37..59f329adfa 100644 --- a/vmware_nsx/common/nsxv_constants.py +++ b/vmware_nsx/common/nsxv_constants.py @@ -36,6 +36,9 @@ INTERNAL_TENANT_ID = 'a1b2c3d4-e5f6-eeff-ffee-6f5e4d3c2b1a' # L2 gateway edge name prefix L2_GATEWAY_EDGE = 'L2 bridging' +# An artificial limit for router name length - subtract 1 for the - separator +ROUTER_NAME_LENGTH = (78 - 1) + # LoadBalancer Certificate constants #NOTE(abhiraut): Number of days specify the total number of days for which the # the certificate will be active. This certificate will expire diff --git a/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py b/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py index dd53f510e2..97e40bb6df 100644 --- a/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py +++ b/vmware_nsx/plugins/nsx_v/vshield/edge_utils.py @@ -645,7 +645,10 @@ class EdgeManager(object): self, context, lrouter, lswitch=None, dist=False, appliance_size=vcns_const.SERVICE_SIZE_MAPPING['router']): """Create an edge for logical router support.""" - router_name = lrouter['name'] + '-' + lrouter['id'] + router_name = ( + lrouter['name'][:nsxv_constants.ROUTER_NAME_LENGTH - + len(lrouter['id'])] + + '-' + lrouter['id']) self._allocate_edge_appliance( context, lrouter['id'], router_name, appliance_size=appliance_size,