Browse Source

Merge "Migrate "ethtool" to oslo.privsep"

changes/40/746640/1
Zuul 10 months ago
committed by Gerrit Code Review
parent
commit
8441737127
5 changed files with 21 additions and 27 deletions
  1. +0
    -1
      etc/neutron/rootwrap.d/dhcp.filters
  2. +0
    -1
      etc/neutron/rootwrap.d/l3.filters
  3. +3
    -3
      neutron/agent/linux/interface.py
  4. +13
    -16
      neutron/privileged/agent/linux/ethtool.py
  5. +5
    -6
      neutron/tests/unit/agent/linux/test_interface.py

+ 0
- 1
etc/neutron/rootwrap.d/dhcp.filters View File

@ -10,7 +10,6 @@
# dhcp-agent
dnsmasq: CommandFilter, dnsmasq, root
ethtool: CommandFilter, ethtool, root
# dhcp-agent uses kill as well, that's handled by the generic KillFilter
# it looks like these are the only signals needed, per
# neutron/agent/linux/dhcp.py


+ 0
- 1
etc/neutron/rootwrap.d/l3.filters View File

@ -12,7 +12,6 @@
arping: CommandFilter, arping, root
# l3_agent
ethtool: CommandFilter, ethtool, root
sysctl: CommandFilter, sysctl, root
route: CommandFilter, route, root
radvd: CommandFilter, radvd, root


+ 3
- 3
neutron/agent/linux/interface.py View File

@ -24,12 +24,12 @@ from oslo_utils import excutils
from pyroute2.netlink import exceptions as pyroute2_exc
from neutron.agent.common import ovs_lib
from neutron.agent.linux import ethtool
from neutron.agent.linux import ip_lib
from neutron.common import utils
from neutron.conf.plugins.ml2.drivers import ovs_conf
from neutron.plugins.ml2.drivers.openvswitch.agent.common \
import constants as ovs_const
from neutron.privileged.agent.linux import ethtool
LOG = logging.getLogger(__name__)
@ -439,8 +439,8 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
# ovs-dpdk does not do checksum calculations for veth interface
# (bug 1832021)
if self.conf.OVS.datapath_type == ovs_const.OVS_DATAPATH_NETDEV:
ethtool.Ethtool.offload(ns_dev.name, rx=False, tx=False,
namespace=namespace)
ethtool.offload(ns_dev.name, rx=False, tx=False,
namespace=namespace)
root_dev.link.set_up()
def unplug(self, device_name, bridge=None, namespace=None, prefix=None):


neutron/agent/linux/ethtool.py → neutron/privileged/agent/linux/ethtool.py View File


+ 5
- 6
neutron/tests/unit/agent/linux/test_interface.py View File

@ -20,7 +20,6 @@ from oslo_utils import excutils
from pyroute2.netlink import exceptions as pyroute2_exc
from neutron.agent.common import ovs_lib
from neutron.agent.linux import ethtool
from neutron.agent.linux import interface
from neutron.agent.linux import ip_lib
from neutron.common import utils
@ -28,6 +27,7 @@ from neutron.conf.agent import common as config
from neutron.conf.plugins.ml2.drivers import ovs_conf
from neutron.plugins.ml2.drivers.openvswitch.agent.common \
import constants as ovs_const
from neutron.privileged.agent.linux import ethtool
from neutron.tests import base
@ -78,8 +78,8 @@ class TestBase(base.BaseTestCase):
self.conf = config.setup_conf()
ovs_conf.register_ovs_opts(self.conf)
config.register_interface_opts(self.conf)
self.eth_tool_p = mock.patch.object(ethtool, 'Ethtool')
self.eth_tool = self.eth_tool_p.start()
self.eth_offload_p = mock.patch.object(ethtool, 'offload')
self.eth_offload = self.eth_offload_p.start()
self.ip_dev_p = mock.patch.object(ip_lib, 'IPDevice')
self.ip_dev = self.ip_dev_p.start()
self.ip_p = mock.patch.object(ip_lib, 'IPWrapper')
@ -591,9 +591,8 @@ class TestOVSInterfaceDriverWithVeth(TestOVSInterfaceDriver):
self.ip.assert_has_calls(expected)
root_dev.assert_has_calls([mock.call.link.set_up()])
ns_dev.assert_has_calls([mock.call.link.set_up()])
self.eth_tool.assert_has_calls([mock.call.offload(
devname, rx=False,
tx=False, namespace=namespace)])
self.eth_offload.assert_has_calls(
[mock.call(devname, rx=False, tx=False, namespace=namespace)])
def test_plug_new(self):
# The purpose of test_plug_new in parent class(TestOVSInterfaceDriver)


Loading…
Cancel
Save