Skip to content
Snippets Groups Projects
Unverified Commit b9b90a5d authored by Erik Berg's avatar Erik Berg
Browse files

Limit interface names to 15 characters

If you give your bridge a long enough name, eg. `br-external`. The
extra characters added to the veth pairs can make the interface name
go beyond the 15 character limit. We can solve this by truncating the
name of the bridge used in the veth names.

Change-Id: I5b890e24195d033897a597a0a93a1cacfb2030d2
parent ebd5799f
No related branches found
No related tags found
No related merge requests found
...@@ -154,7 +154,10 @@ class ActionModule(ActionBase): ...@@ -154,7 +154,10 @@ class ActionModule(ActionBase):
# For a bridge, use a veth pair connected to the bridge. Otherwise # For a bridge, use a veth pair connected to the bridge. Otherwise
# use the interface directly. # use the interface directly.
if is_bridge: 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: else:
external_interface = interface external_interface = interface
neutron_external_interfaces.append(external_interface) neutron_external_interfaces.append(external_interface)
......
...@@ -49,7 +49,10 @@ def _get_veth_interface(context, bridge, inventory_hostname): ...@@ -49,7 +49,10 @@ def _get_veth_interface(context, bridge, inventory_hostname):
inventory_hostname) inventory_hostname)
suffix = utils.get_hostvar(context, 'network_patch_suffix_phy', suffix = utils.get_hostvar(context, 'network_patch_suffix_phy',
inventory_hostname) 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): def _get_veth_peer(context, bridge, inventory_hostname):
...@@ -64,7 +67,10 @@ def _get_veth_peer(context, bridge, inventory_hostname): ...@@ -64,7 +67,10 @@ def _get_veth_peer(context, bridge, inventory_hostname):
inventory_hostname) inventory_hostname)
suffix = utils.get_hostvar(context, 'network_patch_suffix_ovs', suffix = utils.get_hostvar(context, 'network_patch_suffix_ovs',
inventory_hostname) 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): def get_ovs_veths(context, names, inventory_hostname):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment