Merge "ofagent: Support physical_interface_mappings"

This commit is contained in:
Jenkins 2014-10-17 16:09:46 +00:00 committed by Gerrit Code Review
commit 56d4919a1a
3 changed files with 49 additions and 13 deletions

View File

@ -148,16 +148,31 @@ PROVIDER_SUBNET_NAME=${PROVIDER_SUBNET_NAME:-"provider_net"}
# If Q_USE_PROVIDERNET_FOR_PUBLIC=True, use a flat provider network # If Q_USE_PROVIDERNET_FOR_PUBLIC=True, use a flat provider network
# for external interface of neutron l3-agent. In that case, # for external interface of neutron l3-agent. In that case,
# PUBLIC_PHYSICAL_NETWORK specifies provider:physical_network value # PUBLIC_PHYSICAL_NETWORK specifies provider:physical_network value
# used for the network. In case of openvswitch agent, you should # used for the network. In case of ofagent, you should add the
# add the corresponding entry to your OVS_BRIDGE_MAPPINGS. # corresponding entry to your OFAGENT_PHYSICAL_INTERFACE_MAPPINGS.
# For openvswitch agent, you should add the corresponding entry to
# your OVS_BRIDGE_MAPPINGS.
# #
# eg. # eg. (ofagent)
# Q_USE_PROVIDERNET_FOR_PUBLIC=True
# Q_USE_PUBLIC_VETH=True
# PUBLIC_PHYSICAL_NETWORK=public
# OFAGENT_PHYSICAL_INTERFACE_MAPPINGS=public:veth-pub-int
#
# eg. (openvswitch agent)
# Q_USE_PROVIDERNET_FOR_PUBLIC=True # Q_USE_PROVIDERNET_FOR_PUBLIC=True
# PUBLIC_PHYSICAL_NETWORK=public # PUBLIC_PHYSICAL_NETWORK=public
# OVS_BRIDGE_MAPPINGS=public:br-ex # OVS_BRIDGE_MAPPINGS=public:br-ex
Q_USE_PROVIDERNET_FOR_PUBLIC=${Q_USE_PROVIDERNET_FOR_PUBLIC:-False} Q_USE_PROVIDERNET_FOR_PUBLIC=${Q_USE_PROVIDERNET_FOR_PUBLIC:-False}
PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK:-public} PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK:-public}
# If Q_USE_PUBLIC_VETH=True, create and use a veth pair instead of
# PUBLIC_BRIDGE. This is intended to be used with
# Q_USE_PROVIDERNET_FOR_PUBLIC=True.
Q_USE_PUBLIC_VETH=${Q_USE_PUBLIC_VETH:-False}
Q_PUBLIC_VETH_EX=${Q_PUBLIC_VETH_EX:-veth-pub-ex}
Q_PUBLIC_VETH_INT=${Q_PUBLIC_VETH_INT:-veth-pub-int}
# The next two variables are configured by plugin # The next two variables are configured by plugin
# e.g. _configure_neutron_l3_agent or lib/neutron_plugins/* # e.g. _configure_neutron_l3_agent or lib/neutron_plugins/*
# #
@ -543,12 +558,20 @@ function create_neutron_initial_network {
if is_service_enabled q-l3; then if is_service_enabled q-l3; then
# logic is specific to using the l3-agent for l3 # logic is specific to using the l3-agent for l3
if is_neutron_ovs_base_plugin && [[ "$Q_USE_NAMESPACE" = "True" ]]; then if is_neutron_ovs_base_plugin && [[ "$Q_USE_NAMESPACE" = "True" ]]; then
local ext_gw_interface
if [[ "$Q_USE_PUBLIC_VETH" = "True" ]]; then
ext_gw_interface=$Q_PUBLIC_VETH_EX
else
# Disable in-band as we are going to use local port # Disable in-band as we are going to use local port
# to communicate with VMs # to communicate with VMs
sudo ovs-vsctl set Bridge $PUBLIC_BRIDGE other_config:disable-in-band=true sudo ovs-vsctl set Bridge $PUBLIC_BRIDGE \
other_config:disable-in-band=true
ext_gw_interface=$PUBLIC_BRIDGE
fi
CIDR_LEN=${FLOATING_RANGE#*/} CIDR_LEN=${FLOATING_RANGE#*/}
sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $ext_gw_interface
sudo ip link set $PUBLIC_BRIDGE up sudo ip link set $ext_gw_interface up
ROUTER_GW_IP=`neutron port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' '{ print $8; }'` ROUTER_GW_IP=`neutron port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' '{ print $8; }'`
die_if_not_set $LINENO ROUTER_GW_IP "Failure retrieving ROUTER_GW_IP" die_if_not_set $LINENO ROUTER_GW_IP "Failure retrieving ROUTER_GW_IP"
sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP

View File

@ -77,6 +77,10 @@ function neutron_plugin_configure_plugin_agent {
if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE ovs bridge_mappings $OVS_BRIDGE_MAPPINGS iniset /$Q_PLUGIN_CONF_FILE ovs bridge_mappings $OVS_BRIDGE_MAPPINGS
fi fi
if [[ "$OFAGENT_PHYSICAL_INTERFACE_MAPPINGS" != "" ]]; then
iniset /$Q_PLUGIN_CONF_FILE agent physical_interface_mappings \
$OFAGENT_PHYSICAL_INTERFACE_MAPPINGS
fi
AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-ofagent-agent" AGENT_BINARY="$NEUTRON_BIN_DIR/neutron-ofagent-agent"
iniset /$Q_PLUGIN_CONF_FILE agent tunnel_types $Q_TUNNEL_TYPES iniset /$Q_PLUGIN_CONF_FILE agent tunnel_types $Q_TUNNEL_TYPES

View File

@ -79,11 +79,20 @@ function _neutron_ovs_base_configure_l3_agent {
fi fi
neutron-ovs-cleanup neutron-ovs-cleanup
if [[ "$Q_USE_PUBLIC_VETH" = "True" ]]; then
ip link show $Q_PUBLIC_VETH_INT > /dev/null 2>&1 ||
sudo ip link add $Q_PUBLIC_VETH_INT type veth \
peer name $Q_PUBLIC_VETH_EX
sudo ip link set $Q_PUBLIC_VETH_INT up
sudo ip link set $Q_PUBLIC_VETH_EX up
sudo ip addr flush dev $Q_PUBLIC_VETH_EX
else
# --no-wait causes a race condition if $PUBLIC_BRIDGE is not up when ip addr flush is called # --no-wait causes a race condition if $PUBLIC_BRIDGE is not up when ip addr flush is called
sudo ovs-vsctl -- --may-exist add-br $PUBLIC_BRIDGE sudo ovs-vsctl -- --may-exist add-br $PUBLIC_BRIDGE
sudo ovs-vsctl br-set-external-id $PUBLIC_BRIDGE bridge-id $PUBLIC_BRIDGE sudo ovs-vsctl br-set-external-id $PUBLIC_BRIDGE bridge-id $PUBLIC_BRIDGE
# ensure no IP is configured on the public bridge # ensure no IP is configured on the public bridge
sudo ip addr flush dev $PUBLIC_BRIDGE sudo ip addr flush dev $PUBLIC_BRIDGE
fi
} }
function _neutron_ovs_base_configure_nova_vif_driver { function _neutron_ovs_base_configure_nova_vif_driver {