From 0493af3399391ed6003560dbcd46adce0edadfb9 Mon Sep 17 00:00:00 2001 From: Brian Haley Date: Mon, 6 Apr 2020 17:12:03 -0400 Subject: [PATCH] Add Octavia file in devstack/lib Looks like this was initially missed on the OVN migration, but after talking with Octavia, this setup should really all live here since it's SDN-specific things that are being configured. Content basically copied from the octavia devstack/plugin.sh script with some small modifications to support OVN. Change-Id: Idb80cd164c6b41ca6636373696a9a1e7f19b5e62 --- devstack/lib/octavia | 45 ++++++++++++++++++++++++++++++++++++++++++++ devstack/plugin.sh | 1 + 2 files changed, 46 insertions(+) create mode 100644 devstack/lib/octavia diff --git a/devstack/lib/octavia b/devstack/lib/octavia new file mode 100644 index 00000000000..60326898c76 --- /dev/null +++ b/devstack/lib/octavia @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +# Save trace setting +XTRACE=$(set +o | grep xtrace) +set +o xtrace + +if is_plugin_enabled octavia; then + function octavia_create_network_interface_device { + INTERFACE=$1 + MGMT_PORT_ID=$2 + MGMT_PORT_MAC=$3 + + if [[ $NEUTRON_AGENT == "openvswitch" || $Q_AGENT == "openvswitch" || $NEUTRON_AGENT == "ovn" || $Q_AGENT == "ovn" ]]; then + if [[ $NEUTRON_AGENT == "ovn" || $Q_AGENT == "ovn" ]]; then + openstack subnet set --gateway none lb-mgmt-subnet + fi + sudo ovs-vsctl -- --may-exist add-port ${OVS_BRIDGE:-br-int} $INTERFACE -- set Interface $INTERFACE type=internal -- set Interface $INTERFACE external-ids:iface-status=active -- set Interface $INTERFACE external-ids:attached-mac=$MGMT_PORT_MAC -- set Interface $INTERFACE external-ids:iface-id=$MGMT_PORT_ID -- set Interface $INTERFACE external-ids:skip_cleanup=true + elif [[ $NEUTRON_AGENT == "linuxbridge" || $Q_AGENT == "linuxbridge" ]]; then + if ! ip link show $INTERFACE ; then + sudo ip link add $INTERFACE type veth peer name o-bhm0 + NETID=$(openstack network show lb-mgmt-net -c id -f value) + BRNAME=brq$(echo $NETID|cut -c 1-11) + sudo ip link set o-bhm0 master $BRNAME + sudo ip link set o-bhm0 up + fi + else + die "Unknown network controller - $NEUTRON_AGENT/$Q_AGENT" + fi + } + + function octavia_delete_network_interface_device { + if [[ $NEUTRON_AGENT == "openvswitch" || $Q_AGENT == "openvswitch" || $NEUTRON_AGENT == "ovn" || $Q_AGENT == "ovn" ]]; then + : # Do nothing + elif [[ $NEUTRON_AGENT == "linuxbridge" || $Q_AGENT == "linuxbridge" ]]; then + if ip link show $INTERFACE ; then + sudo ip link del $INTERFACE + fi + else + die "Unknown network controller - $NEUTRON_AGENT/$Q_AGENT" + fi + } +fi + +# Restore xtrace +$XTRACE diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 1e353e52995..556a32c5ef0 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -17,6 +17,7 @@ source $LIBDIR/log source $LIBDIR/fip_port_forwarding source $LIBDIR/uplink_status_propagation source $LIBDIR/tag_ports_during_bulk_creation +source $LIBDIR/octavia Q_BUILD_OVS_FROM_GIT=$(trueorfalse False Q_BUILD_OVS_FROM_GIT)