Add option for extra kernel modules in neutron role

Closes-Bug: #2036741

Change-Id: Ib448d04e43dff78e344064161beadae917c41206
This commit is contained in:
Bartosz Bezak 2023-09-12 14:03:19 +02:00
parent 59ab6bf049
commit 7186f960d9
6 changed files with 61 additions and 3 deletions

View File

@ -712,6 +712,13 @@ neutron_bootstrap_services: "{{ neutron_subprojects | selectattr('enabled') | ma
neutron_enable_rolling_upgrade: "yes"
neutron_rolling_upgrade_services: "{{ neutron_subprojects | selectattr('enabled') | map(attribute='name') | list }}"
####################
# Neutron modules
####################
neutron_modules_default:
- name: 'ip6_tables'
neutron_modules_extra: []
####################
# Service Plugins
####################

View File

@ -1,10 +1,9 @@
---
- name: Load and persist ip6_tables module
- name: Load and persist kernel modules
include_role:
name: module-load
vars:
modules:
- {'name': ip6_tables}
modules: "{{ neutron_modules_default + neutron_modules_extra }}"
when: >-
neutron_services |
select_services_enabled_and_mapped_to_host |

View File

@ -214,3 +214,25 @@ authentication in external systems (e.g. in ``networking-generic-switch`` or
You can set ``neutron_ssh_key`` variable in ``passwords.yml`` to control the
used key.
Custom Kernel Module Configuration for Neutron
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Neutron may require specific kernel modules for certain functionalities.
While there are predefined default modules in the Ansible role, users have
the flexibility to add custom modules as needed.
To add custom kernel modules for Neutron, modify the configuration in
``/etc/kolla/globals.yml``:
.. code-block:: yaml
neutron_modules_extra:
- name: 'nf_conntrack_tftp'
params: 'hashsize=4096'
In this example:
- `neutron_modules_extra`: Allows users to specify additional modules and
their associated parameters. The given configuration adjusts the
`hashsize` parameter for the `nf_conntrack_tftp` module.

View File

@ -0,0 +1,6 @@
---
features:
- |
Added capability to specify custom kernel modules for Neutron:
`neutron_modules_default`: Lists default modules.
`neutron_modules_extra`: For custom modules and parameters.

View File

@ -198,3 +198,7 @@ enable_venus: "yes"
{% if groups['all'] | length == 1 %}
keepalived_track_script_enabled: "no"
{% endif %}
neutron_modules_extra:
- name: 'nf_conntrack_tftp'
- name: 'nf_nat_tftp'

View File

@ -209,6 +209,25 @@ function unset_cirros_image_q35_machine_type {
openstack image unset --property hw_machine_type cirros
}
function test_neutron_modules {
# Exit the function if scenario is "ovn" or if there's an upgrade
# as inly concerns ml2/ovs
if [[ $SCENARIO == "ovn" ]] || [[ $HAS_UPGRADE == "yes" ]]; then
return
fi
local modules
modules=( $(sed -n '/neutron_modules_extra:/,/^[^ ]/p' /etc/kolla/globals.yml | grep -oP '^ - name: \K[^ ]+' | tr -d "'") )
for module in "${modules[@]}"; do
if ! grep -q "^${module} " /proc/modules; then
echo "Error: Module $module is not loaded."
exit 1
else
echo "Module $module is loaded."
fi
done
}
function test_ssh {
local instance_name=$1
local fip_addr=$2
@ -354,6 +373,7 @@ function test_openstack_logged {
. /etc/kolla/admin-openrc.sh
. ~/openstackclient-venv/bin/activate
test_smoke
test_neutron_modules
test_instance_boot
# Check for x86_64 architecture to run q35 tests