ironic/devstack/tools/ironic/scripts/setup-network.sh
Julia Kreger 6d3c4ced5f Disable spanning tree
So, I've long wondered if we still have some spanning tree behavior
going on in CI. Turns out we might, but we just rely upon the defaults
which creates a variable.

Anyway, regardless, I found some details in the ovs-vsctl manual[0], and
well, lets set the options!

[0]: http://www.openvswitch.org/support/dist-docs/ovs-vsctl.8.html

Change-Id: I8f229fa6e738a69a668d4b891723431b2da362fa
2023-07-06 17:16:33 +00:00

35 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# **setup-network**
# Setups openvswitch libvirt network suitable for
# running baremetal poseur nodes for ironic testing purposes
set -exu
# Make tracing more educational
export PS4='+ ${BASH_SOURCE:-}:${FUNCNAME[0]:-}:L${LINENO:-}: '
LIBVIRT_CONNECT_URI=${LIBVIRT_CONNECT_URI:-"qemu:///system"}
# Keep track of the DevStack directory
TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
BRIDGE_NAME=${1:-brbm}
PUBLIC_BRIDGE_MTU=${2:-1500}
export VIRSH_DEFAULT_CONNECT_URI="$LIBVIRT_CONNECT_URI"
# Only add bridge if missing. Bring it UP.
(sudo ovs-vsctl list-br | grep ${BRIDGE_NAME}) || sudo ovs-vsctl add-br ${BRIDGE_NAME} && ovs-vsctl set Bridge ${BRIDGE_NAME} stp_enable=False && ovs-vsctl set Bridge ${BRIDGE_NAME} rstp_enable=false
sudo ip link set dev ${BRIDGE_NAME} up
# Remove bridge before replacing it.
(virsh net-list | grep "${BRIDGE_NAME} ") && virsh net-destroy ${BRIDGE_NAME}
(virsh net-list --inactive | grep "${BRIDGE_NAME} ") && virsh net-undefine ${BRIDGE_NAME}
virsh net-define <(sed s/brbm/$BRIDGE_NAME/ $TOP_DIR/templates/brbm.xml)
virsh net-autostart ${BRIDGE_NAME}
virsh net-start ${BRIDGE_NAME}
sudo ip link set dev ${BRIDGE_NAME} mtu $PUBLIC_BRIDGE_MTU