Support setting ethtool options on network interfaces

Change-Id: I5650b8b489d5968b42526e45667dfc7fa6ad7b2f
Story: 2008020
Task: 40672
This commit is contained in:
Pierre Riteau 2020-08-17 16:35:11 +02:00
parent f6f08df6b1
commit ea4a507f04
4 changed files with 20 additions and 1 deletions

View File

@ -136,6 +136,7 @@ net_rules = _make_attr_filter('rules')
net_physical_network = _make_attr_filter('physical_network') net_physical_network = _make_attr_filter('physical_network')
net_bootproto = _make_attr_filter('bootproto') net_bootproto = _make_attr_filter('bootproto')
net_defroute = _make_attr_filter('defroute') net_defroute = _make_attr_filter('defroute')
net_ethtool_opts = _make_attr_filter('ethtool_opts')
@jinja2.contextfilter @jinja2.contextfilter
@ -212,6 +213,7 @@ def net_interface_obj(context, name, inventory_hostname=None):
rules = net_rules(context, name, inventory_hostname) rules = net_rules(context, name, inventory_hostname)
bootproto = net_bootproto(context, name, inventory_hostname) bootproto = net_bootproto(context, name, inventory_hostname)
defroute = net_defroute(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) vip_address = net_vip_address(context, name, inventory_hostname)
allowed_addresses = [vip_address] if vip_address else None allowed_addresses = [vip_address] if vip_address else None
interface = { interface = {
@ -225,6 +227,7 @@ def net_interface_obj(context, name, inventory_hostname=None):
'rules': rules, 'rules': rules,
'bootproto': bootproto or 'static', 'bootproto': bootproto or 'static',
'defroute': defroute, 'defroute': defroute,
'ethtool_opts': ethtool_opts,
'allowed_addresses': allowed_addresses, 'allowed_addresses': allowed_addresses,
'onboot': 'yes', 'onboot': 'yes',
} }
@ -259,6 +262,7 @@ def net_bridge_obj(context, name, inventory_hostname=None):
rules = net_rules(context, name, inventory_hostname) rules = net_rules(context, name, inventory_hostname)
bootproto = net_bootproto(context, name, inventory_hostname) bootproto = net_bootproto(context, name, inventory_hostname)
defroute = net_defroute(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) vip_address = net_vip_address(context, name, inventory_hostname)
allowed_addresses = [vip_address] if vip_address else None allowed_addresses = [vip_address] if vip_address else None
interface = { interface = {
@ -273,6 +277,7 @@ def net_bridge_obj(context, name, inventory_hostname=None):
'rules': rules, 'rules': rules,
'bootproto': bootproto or 'static', 'bootproto': bootproto or 'static',
'defroute': defroute, 'defroute': defroute,
'ethtool_opts': ethtool_opts,
'allowed_addresses': allowed_addresses, 'allowed_addresses': allowed_addresses,
'onboot': 'yes', 'onboot': 'yes',
} }
@ -313,6 +318,7 @@ def net_bond_obj(context, name, inventory_hostname=None):
rules = net_rules(context, name, inventory_hostname) rules = net_rules(context, name, inventory_hostname)
bootproto = net_bootproto(context, name, inventory_hostname) bootproto = net_bootproto(context, name, inventory_hostname)
defroute = net_defroute(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) vip_address = net_vip_address(context, name, inventory_hostname)
allowed_addresses = [vip_address] if vip_address else None allowed_addresses = [vip_address] if vip_address else None
interface = { interface = {
@ -333,6 +339,7 @@ def net_bond_obj(context, name, inventory_hostname=None):
'rules': rules, 'rules': rules,
'bootproto': bootproto or 'static', 'bootproto': bootproto or 'static',
'defroute': defroute, 'defroute': defroute,
'ethtool_opts': ethtool_opts,
'allowed_addresses': allowed_addresses, 'allowed_addresses': allowed_addresses,
'onboot': 'yes', 'onboot': 'yes',
} }
@ -489,6 +496,7 @@ class FilterModule(object):
'net_physical_network': net_physical_network, 'net_physical_network': net_physical_network,
'net_bootproto': net_bootproto, 'net_bootproto': net_bootproto,
'net_defroute': net_defroute, 'net_defroute': net_defroute,
'net_ethtool_opts': net_ethtool_opts,
'net_interface_obj': net_interface_obj, 'net_interface_obj': net_interface_obj,
'net_bridge_obj': net_bridge_obj, 'net_bridge_obj': net_bridge_obj,
'net_bond_obj': net_bond_obj, 'net_bond_obj': net_bond_obj,

View File

@ -321,6 +321,11 @@ The following attributes are supported:
For bond interfaces, the xmit_hash_policy to use for the bond. For bond interfaces, the xmit_hash_policy to use for the bond.
``bond_lacp_rate`` ``bond_lacp_rate``
For bond interfaces, the lacp_rate to use for the bond. 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 IP Addresses
------------ ------------

View File

@ -0,0 +1,6 @@
---
features:
- |
Adds support for configuring ``ethtool`` options on physical network
interfaces. See `story 2008020
<https://storyboard.openstack.org/#!/story/2008020>`__ for details.

View File

@ -5,7 +5,7 @@
# There are no versioned releases of this role. # There are no versioned releases of this role.
version: 8438592c84585c86e62ae07e526d3da53629b377 version: 8438592c84585c86e62ae07e526d3da53629b377
- src: MichaelRigart.interfaces - src: MichaelRigart.interfaces
version: v1.6.0 version: v1.8.1
- src: mrlesmithjr.manage-lvm - src: mrlesmithjr.manage-lvm
version: v0.1.4 version: v0.1.4
- src: mrlesmithjr.mdadm - src: mrlesmithjr.mdadm