Merge "Work with pyroute2 0.6.4"

This commit is contained in:
Zuul 2021-06-08 19:47:35 +00:00 committed by Gerrit Code Review
commit 6d8e3b0fc5
3 changed files with 7 additions and 5 deletions

View File

@ -20,6 +20,7 @@ import os_vif
from os_vif.objects import vif as osv_objects
from oslo_log import log as logging
import pyroute2
from pyroute2 import netns as pyroute_netns
from stevedore import driver as stv_driver
from kuryr_kubernetes.cni import utils as cni_utils
@ -82,14 +83,14 @@ def _enable_ipv6(netns):
netns = utils.convert_netns(netns)
path = utils.convert_netns('/proc/self/ns/net')
self_ns_fd = open(path)
pyroute2.netns.setns(netns)
pyroute_netns.setns(netns)
path = utils.convert_netns('/proc/sys/net/ipv6/conf/all/disable_ipv6')
with open(path, 'w') as disable_ipv6:
disable_ipv6.write('0')
except Exception:
raise
finally:
pyroute2.netns.setns(self_ns_fd)
pyroute_netns.setns(self_ns_fd)
def _configure_l3(vif, ifname, netns, is_default_gateway):

View File

@ -19,6 +19,7 @@ import os
from oslo_log import log as logging
import psutil
import pyroute2
from pyroute2 import netlink as pyroute_netlink
from kuryr_kubernetes.cni.binding import base as b_base
from kuryr_kubernetes import config
@ -72,7 +73,7 @@ class NestedDriver(health.HealthHandler, b_base.BaseBindingDriver,
if type(name) is int: # Skip ones duplicated by id
continue
if iface['flags'] & pyroute2.netlink.rtnl.ifinfmsg.IFF_LOOPBACK:
if iface['flags'] & pyroute_netlink.rtnl.ifinfmsg.IFF_LOOPBACK:
continue # Skip loopback
LOG.debug(f'Using interface {name} as bridge interface.')

View File

@ -367,7 +367,7 @@ class VIFSriovDriver(health.HealthHandler, b_base.BaseBindingDriver):
pf_index = ip.link_lookup(ifname=pf)[0]
try:
ip.link("set", index=pf_index, vf={"vf": vf_index, "mac": mac})
except pyroute2.netlink.exceptions.NetlinkError:
except pyroute2.NetlinkError:
LOG.exception("Unable to set mac for VF %s on pf %s",
vf_index, pf)
raise
@ -380,7 +380,7 @@ class VIFSriovDriver(health.HealthHandler, b_base.BaseBindingDriver):
try:
ip.link("set", index=pf_index, vf={"vf": vf_index,
"vlan": vlan_id})
except pyroute2.netlink.exceptions.NetlinkError:
except pyroute2.NetlinkError:
LOG.exception("Unable to set vlan for VF %s on pf %s",
vf_index, pf)
raise