Work with pyroute2 0.6.4
pyroute2 0.6.4 seems to break us due to their packages split. This commit attempts to fix it by making sure we import modules correctly. Change-Id: I30ef9ce99b039d00f63ced6e78fd4cfe432b50f6
This commit is contained in:
parent
e005247b89
commit
1c2cd78966
|
@ -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):
|
||||
|
|
|
@ -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.')
|
||||
|
|
|
@ -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…
Reference in New Issue