From ea4a507f04502a2b6fe7a1756c23a19f7ce0bd35 Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Mon, 17 Aug 2020 16:35:11 +0200 Subject: [PATCH] Support setting ethtool options on network interfaces Change-Id: I5650b8b489d5968b42526e45667dfc7fa6ad7b2f Story: 2008020 Task: 40672 --- ansible/filter_plugins/networks.py | 8 ++++++++ doc/source/configuration/network.rst | 5 +++++ releasenotes/notes/ethtool-options-e90ace0555e3fba3.yaml | 6 ++++++ requirements.yml | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/ethtool-options-e90ace0555e3fba3.yaml diff --git a/ansible/filter_plugins/networks.py b/ansible/filter_plugins/networks.py index 6812aa181..caff302dd 100644 --- a/ansible/filter_plugins/networks.py +++ b/ansible/filter_plugins/networks.py @@ -136,6 +136,7 @@ net_rules = _make_attr_filter('rules') net_physical_network = _make_attr_filter('physical_network') net_bootproto = _make_attr_filter('bootproto') net_defroute = _make_attr_filter('defroute') +net_ethtool_opts = _make_attr_filter('ethtool_opts') @jinja2.contextfilter @@ -212,6 +213,7 @@ def net_interface_obj(context, name, inventory_hostname=None): rules = net_rules(context, name, inventory_hostname) bootproto = net_bootproto(context, name, inventory_hostname) defroute = net_defroute(context, name, inventory_hostname) + ethtool_opts = net_ethtool_opts(context, name, inventory_hostname) vip_address = net_vip_address(context, name, inventory_hostname) allowed_addresses = [vip_address] if vip_address else None interface = { @@ -225,6 +227,7 @@ def net_interface_obj(context, name, inventory_hostname=None): 'rules': rules, 'bootproto': bootproto or 'static', 'defroute': defroute, + 'ethtool_opts': ethtool_opts, 'allowed_addresses': allowed_addresses, 'onboot': 'yes', } @@ -259,6 +262,7 @@ def net_bridge_obj(context, name, inventory_hostname=None): rules = net_rules(context, name, inventory_hostname) bootproto = net_bootproto(context, name, inventory_hostname) defroute = net_defroute(context, name, inventory_hostname) + ethtool_opts = net_ethtool_opts(context, name, inventory_hostname) vip_address = net_vip_address(context, name, inventory_hostname) allowed_addresses = [vip_address] if vip_address else None interface = { @@ -273,6 +277,7 @@ def net_bridge_obj(context, name, inventory_hostname=None): 'rules': rules, 'bootproto': bootproto or 'static', 'defroute': defroute, + 'ethtool_opts': ethtool_opts, 'allowed_addresses': allowed_addresses, 'onboot': 'yes', } @@ -313,6 +318,7 @@ def net_bond_obj(context, name, inventory_hostname=None): rules = net_rules(context, name, inventory_hostname) bootproto = net_bootproto(context, name, inventory_hostname) defroute = net_defroute(context, name, inventory_hostname) + ethtool_opts = net_ethtool_opts(context, name, inventory_hostname) vip_address = net_vip_address(context, name, inventory_hostname) allowed_addresses = [vip_address] if vip_address else None interface = { @@ -333,6 +339,7 @@ def net_bond_obj(context, name, inventory_hostname=None): 'rules': rules, 'bootproto': bootproto or 'static', 'defroute': defroute, + 'ethtool_opts': ethtool_opts, 'allowed_addresses': allowed_addresses, 'onboot': 'yes', } @@ -489,6 +496,7 @@ class FilterModule(object): 'net_physical_network': net_physical_network, 'net_bootproto': net_bootproto, 'net_defroute': net_defroute, + 'net_ethtool_opts': net_ethtool_opts, 'net_interface_obj': net_interface_obj, 'net_bridge_obj': net_bridge_obj, 'net_bond_obj': net_bond_obj, diff --git a/doc/source/configuration/network.rst b/doc/source/configuration/network.rst index 18e536c11..f99242f54 100644 --- a/doc/source/configuration/network.rst +++ b/doc/source/configuration/network.rst @@ -321,6 +321,11 @@ The following attributes are supported: For bond interfaces, the xmit_hash_policy to use for the bond. ``bond_lacp_rate`` For bond interfaces, the lacp_rate to use for the bond. +``ethtool_opts`` + Physical network interface options to apply with ``ethtool``. When used on + bond and bridge interfaces, settings apply to underlying interfaces. This + should be a string of arguments passed to the ``ethtool`` utility, for + example ``"-G ${DEVICE} rx 8192 tx 8192"``. IP Addresses ------------ diff --git a/releasenotes/notes/ethtool-options-e90ace0555e3fba3.yaml b/releasenotes/notes/ethtool-options-e90ace0555e3fba3.yaml new file mode 100644 index 000000000..cdacc1673 --- /dev/null +++ b/releasenotes/notes/ethtool-options-e90ace0555e3fba3.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Adds support for configuring ``ethtool`` options on physical network + interfaces. See `story 2008020 + `__ for details. diff --git a/requirements.yml b/requirements.yml index e79a01a4a..44f127d2f 100644 --- a/requirements.yml +++ b/requirements.yml @@ -5,7 +5,7 @@ # There are no versioned releases of this role. version: 8438592c84585c86e62ae07e526d3da53629b377 - src: MichaelRigart.interfaces - version: v1.6.0 + version: v1.8.1 - src: mrlesmithjr.manage-lvm version: v0.1.4 - src: mrlesmithjr.mdadm