From 9e3a54805aad53a42ac61d6df8c1b803ccbb731a Mon Sep 17 00:00:00 2001 From: Jakub Libosvar Date: Tue, 9 Jan 2024 19:36:25 +0000 Subject: [PATCH] devstack: Install vrf kernel module if needed Depending on how the kernel was compiled vrf kernel module may not be present on the box. This patch installs required packages that contain vrf kernel module and installs the module as part of `install_ovn_bgp_agent` function. Change-Id: Ieb8351cf4eef6db7dc56fb21be9d0cedf6d2ffca --- devstack/lib/ovn-bgp-agent | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/devstack/lib/ovn-bgp-agent b/devstack/lib/ovn-bgp-agent index 4f6b8fd0..a2d1c7c7 100644 --- a/devstack/lib/ovn-bgp-agent +++ b/devstack/lib/ovn-bgp-agent @@ -83,6 +83,21 @@ function cleanup_frr { sudo rm -rf $FRR_CONF_DIR } +function install_vrf_kernel_module_if_needed { + # If the kernel vrf was compiled separately as a module + if [ "$(grep CONFIG_NET_VRF /boot/config-$(uname -r) | cut -d = -f 2)" == "m" ]; then + if is_ubuntu; then + apt_get install linux-modules-extra-$(uname -r) + fi + + if is_fedora; then + sudo dnf install -y kernel-modules-core-$(uname -r) + fi + + sudo modprobe vrf + fi +} + function install_ovn_bgp_agent { echo_summary "Installing OVN BGP Agent" @@ -95,6 +110,8 @@ function install_ovn_bgp_agent { write_user_unit_file $OVN_BGP_AGENT_SYSTEMD_SERVICE "$cmd" "" "root" $SYSTEMCTL daemon-reload enable_service $OVN_BGP_AGENT_SYSTEMD_SERVICE + + install_vrf_kernel_module_if_needed } function configure_ovn_bgp_agent {