Truncate edge appliance name when too long
This patch addresses an issue when a user sets a very long name to an exclusive or distributed routers. Currently we set the edge appliance name to <router-name>-<router-id> and this may exceed the maximum length which is allowed by NSXv. Change-Id: I9db4b5420227fe9cb4356743de86792e0440b575
This commit is contained in:
parent
307133d844
commit
db300459a5
@ -36,6 +36,9 @@ INTERNAL_TENANT_ID = 'a1b2c3d4-e5f6-eeff-ffee-6f5e4d3c2b1a'
|
|||||||
# L2 gateway edge name prefix
|
# L2 gateway edge name prefix
|
||||||
L2_GATEWAY_EDGE = 'L2 bridging'
|
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
|
# LoadBalancer Certificate constants
|
||||||
#NOTE(abhiraut): Number of days specify the total number of days for which the
|
#NOTE(abhiraut): Number of days specify the total number of days for which the
|
||||||
# the certificate will be active. This certificate will expire
|
# the certificate will be active. This certificate will expire
|
||||||
|
@ -645,7 +645,10 @@ class EdgeManager(object):
|
|||||||
self, context, lrouter, lswitch=None, dist=False,
|
self, context, lrouter, lswitch=None, dist=False,
|
||||||
appliance_size=vcns_const.SERVICE_SIZE_MAPPING['router']):
|
appliance_size=vcns_const.SERVICE_SIZE_MAPPING['router']):
|
||||||
"""Create an edge for logical router support."""
|
"""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(
|
self._allocate_edge_appliance(
|
||||||
context, lrouter['id'], router_name,
|
context, lrouter['id'], router_name,
|
||||||
appliance_size=appliance_size,
|
appliance_size=appliance_size,
|
||||||
|
Loading…
Reference in New Issue
Block a user