Merge "Truncate edge appliance name when too long"

This commit is contained in:
Jenkins 2016-01-12 11:25:19 +00:00 committed by Gerrit Code Review
commit 8785d5fdde
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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,