From 5344885a61fe39565692014c15e0b4fb1055c835 Mon Sep 17 00:00:00 2001 From: Sean Mooney Date: Thu, 17 Jun 2021 12:37:35 +0100 Subject: [PATCH] os_vif: Add support for configuring os_vif_ovs plugin This change add an os-vif lib that declares two new variables OS_VIF_OVS_OVSDB_INTERFACE and OS_VIF_OVS_ISOLATE_VIF The former is introduced to workaround bug #1929446 which cause the nova and neutron agents to periodically block waiting for ovs to respond. OS_VIF_OVS_ISOLATE_VIF is added to address bug #1734320 when using ml2/ovs vif isolation should always be used to prevent cross tenant traffic during a live migration. This makes devstack more closely mirror reality by enabling it when ml2/ovs is used and disabling it otherwise. Related-Bug: #1734320 Related-Bug: #1929446 Related-Bug: #1912310 Change-Id: I88254c6e22b52585506ee4907c1c03b8d4f2dac7 --- lib/os-vif | 29 +++++++++++++++++++++++++++++ stack.sh | 6 ++++++ 2 files changed, 35 insertions(+) create mode 100644 lib/os-vif diff --git a/lib/os-vif b/lib/os-vif new file mode 100644 index 0000000000..865645c0d5 --- /dev/null +++ b/lib/os-vif @@ -0,0 +1,29 @@ +#!/bin/bash + +# support vsctl or native. +# until bug #1929446 is resolved we override the os-vif default +# and fall back to the legacy "vsctl" driver. +OS_VIF_OVS_OVSDB_INTERFACE=${OS_VIF_OVS_OVSDB_INTERFACE:="vsctl"} + +function is_ml2_ovs { + if [[ "${Q_AGENT}" == "openvswitch" ]]; then + echo "True" + fi + echo "False" +} + +# This should be true for any ml2/ovs job but should be set to false for +# all other ovs based jobs e.g. ml2/ovn +OS_VIF_OVS_ISOLATE_VIF=${OS_VIF_OVS_ISOLATE_VIF:=$(is_ml2_ovs)} +OS_VIF_OVS_ISOLATE_VIF=$(trueorfalse False OS_VIF_OVS_ISOLATE_VIF) + +function configure_os_vif { + if [[ -e ${NOVA_CONF} ]]; then + iniset ${NOVA_CONF} os_vif_ovs ovsdb_interface ${OS_VIF_OVS_OVSDB_INTERFACE} + iniset ${NOVA_CONF} os_vif_ovs isolate_vif ${OS_VIF_OVS_ISOLATE_VIF} + fi + if [[ -e ${NEUTRON_CONF} ]]; then + iniset ${NEUTRON_CONF} os_vif_ovs ovsdb_interface ${OS_VIF_OVS_OVSDB_INTERFACE} + iniset ${NEUTRON_CONF} os_vif_ovs isolate_vif ${OS_VIF_OVS_ISOLATE_VIF} + fi +} diff --git a/stack.sh b/stack.sh index 6858ab8c42..44f1c8fa01 100755 --- a/stack.sh +++ b/stack.sh @@ -597,6 +597,7 @@ source $TOP_DIR/lib/ldap source $TOP_DIR/lib/dstat source $TOP_DIR/lib/tcpdump source $TOP_DIR/lib/etcd3 +source $TOP_DIR/lib/os-vif # Extras Source # -------------- @@ -1159,6 +1160,11 @@ if is_service_enabled q-dhcp; then sudo sysctl -w net.ipv4.ip_forward=1 fi +# os-vif +# ------ +if is_service_enabled nova neutron; then + configure_os_vif +fi # Storage Service # ---------------