Merge "Limit interface names to 15 characters"

This commit is contained in:
Zuul 2023-05-25 17:15:35 +00:00 committed by Gerrit Code Review
commit 7f4ba45191
2 changed files with 12 additions and 3 deletions

View File

@ -154,7 +154,10 @@ class ActionModule(ActionBase):
# For a bridge, use a veth pair connected to the bridge. Otherwise
# use the interface directly.
if is_bridge:
external_interface = patch_prefix + interface + patch_suffix
# interface names can't be longer than 15 characters
char_limit = 15 - len(patch_prefix) - len(patch_suffix)
external_interface = patch_prefix + interface[:char_limit] + \
patch_suffix
else:
external_interface = interface
neutron_external_interfaces.append(external_interface)

View File

@ -49,7 +49,10 @@ def _get_veth_interface(context, bridge, inventory_hostname):
inventory_hostname)
suffix = utils.get_hostvar(context, 'network_patch_suffix_phy',
inventory_hostname)
return prefix + bridge + suffix
# interface names can't be longer than 15 characters
char_limit = 15 - len(prefix) - len(suffix)
return prefix + bridge[:char_limit] + suffix
def _get_veth_peer(context, bridge, inventory_hostname):
@ -64,7 +67,10 @@ def _get_veth_peer(context, bridge, inventory_hostname):
inventory_hostname)
suffix = utils.get_hostvar(context, 'network_patch_suffix_ovs',
inventory_hostname)
return prefix + bridge + suffix
# interface names can't be longer than 15 characters
char_limit = 15 - len(prefix) - len(suffix)
return prefix + bridge[:char_limit] + suffix
def get_ovs_veths(context, names, inventory_hostname):