charm-neutron-openvswitch/hooks/install
Przemysław Lal ad7f870c0d Use OVS charmhelpers to set up DPDK ports and bridges
Replace deprecated code that was used for setting up DPDK ports and
bonds with calls to charmhelpers functions.
Pass DPDK configuration using ifdata and portdata dicts instead of
making direct ovs-vsctl calls.
Move installation of sriov-netplan-shim to the bash wrapper. This
resolves problems with non-working imports of sriov-netplan-shim in
charmhelpers.

Update unit tests to reflect that change.

Signed-off-by: Przemysław Lal <przemyslaw.lal@canonical.com>
Change-Id: Ica6f3ea66136bca6c77a5fb55ad7ef5d95aa1f6a
2021-04-01 16:46:32 +00:00

28 lines
913 B
Bash
Executable File

#!/bin/bash -e
# Wrapper to ensure that python dependencies are installed before we get into
# the python part of the hook execution.
check_and_install() {
pkg="${1}"
if ! dpkg -s ${pkg} 2>&1 > /dev/null; then
apt-get -y install ${pkg}
fi
}
# NOTE: If any of enable-dpdk, enable-sriov and enable-hardware-offload config
# options is set to `True` then package sriov-netplan-shim from
# ppa:openstack-charmers/networking-tools must be installed.
USE_DPDK=`config-get enable-dpdk`
USE_SRIOV=`config-get enable-sriov`
USE_HW_OFFLOAD=`config-get enable-hardware-offload`
NETWORKING_TOOLS_PPA=`config-get networking-tools-source`
if [[ $NETWORKING_TOOLS_PPA ]] && \
[[ $USE_DPDK == "True" || $USE_SRIOV == "True" || $USE_HW_OFFLOAD == "True" ]]; then
apt-add-repository --yes $NETWORKING_TOOLS_PPA
apt-get update
check_and_install sriov-netplan-shim
fi
exec ./hooks/install.real