From 2500ca0b22476aa4e954ea87aa22ca9443ed2be8 Mon Sep 17 00:00:00 2001 From: Brian Haley Date: Mon, 20 Jul 2020 16:59:34 -0400 Subject: [PATCH] Update octavia plugin code When the Octavia plugin code was moved to the Neutron repo it was put under an 'if is_plugin_enabled octavia' check. Depending on the way a node is built, sometimes the function doesn't seem to be defined, so remove it since it's ok to always define it. Change-Id: Ib8c7bac4d0111345f30b7d160fe9b4a8f2132106 --- devstack/lib/octavia | 63 ++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/devstack/lib/octavia b/devstack/lib/octavia index 60326898c76..3f48b464dbe 100644 --- a/devstack/lib/octavia +++ b/devstack/lib/octavia @@ -4,42 +4,41 @@ 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 +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" + 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" +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 - } -fi + else + die "Unknown network controller - $NEUTRON_AGENT/$Q_AGENT" + fi +} # Restore xtrace $XTRACE