Browse Source

Merge "Work with pyroute2 0.6.4"

changes/22/795322/7
Zuul 1 week ago
committed by Gerrit Code Review
parent
commit
6d8e3b0fc5
3 changed files with 7 additions and 5 deletions
  1. +3
    -2
      kuryr_kubernetes/cni/binding/base.py
  2. +2
    -1
      kuryr_kubernetes/cni/binding/nested.py
  3. +2
    -2
      kuryr_kubernetes/cni/binding/sriov.py

+ 3
- 2
kuryr_kubernetes/cni/binding/base.py 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):


+ 2
- 1
kuryr_kubernetes/cni/binding/nested.py 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.')


+ 2
- 2
kuryr_kubernetes/cni/binding/sriov.py 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

Loading…
Cancel
Save