Trimm interface name consistently

In create_interface method we trimm interface name up to 16 symbols,
however in all following methods we do not care about same trimm, which
causes calls to such interfaces fail with NetworkInterfaceNotFound

Closes-Bug: #2054599
Change-Id: I15f773afa64079eec6534c53eab0e9b7dd796d5f
This commit is contained in:
Dmitriy Rabotyagov 2024-02-21 19:53:51 +01:00
parent 921e39ba02
commit 1ac77aba49

View File

@ -534,16 +534,19 @@ def create_interface(ifname, kind, **kwargs):
@ovn_bgp_agent.privileged.default.entrypoint
def delete_interface(ifname, **kwargs):
ifname = ifname[:15]
_run_iproute_link('del', ifname, **kwargs)
@ovn_bgp_agent.privileged.default.entrypoint
def set_link_attribute(ifname, **kwargs):
ifname = ifname[:15]
_run_iproute_link("set", ifname, **kwargs)
@ovn_bgp_agent.privileged.default.entrypoint
def add_ip_address(ip_address, ifname):
ifname = ifname[:15]
net = netaddr.IPNetwork(ip_address)
ip_version = l_net.get_ip_version(ip_address)
address = str(net.ip)
@ -558,6 +561,7 @@ def add_ip_address(ip_address, ifname):
@ovn_bgp_agent.privileged.default.entrypoint
def delete_ip_address(ip_address, ifname):
ifname = ifname[:15]
net = netaddr.IPNetwork(ip_address)
ip_version = l_net.get_ip_version(ip_address)
address = str(net.ip)