From 6a008fa74bce0497b7902dd95300599a3026e2dd Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 3 Aug 2016 15:09:01 -0400 Subject: [PATCH] Change to neutron by default. nova-net is deprecated, and it's long time to switch to neutron by default. This patch does that, and has an auto configuration mode that mostly just works for the basic case. It does this by assuming that unless the user specifies an interface for it to manage, that it will not automatically have access to a physical interface. The floating range is put on br-ex (per normal), fixed ranges stay on their OVS interfaces. Because there is no dedicated interface managed by neutron, we add an iptables rule which allows guests to route out. While somewhat synthetic, it does provide a working out of the box developer experience, and is not hugely more synthetic then all the other interface / route setup we have to do for the system. You should be able to run this with a local.conf of just [[local|localrc]] ADMIN_PASSWORD=pass DATABASE_PASSWORD=pass RABBIT_PASSWORD=pass SERVICE_PASSWORD=pass And get a working neutron on a single interface box Documentation will come in subsequent patches, however getting the code out there and getting feedback is going to help shape this direction. Change-Id: I185325a684372e8a2ff25eae974a9a2a2d6277e0 --- lib/neutron_plugins/services/l3 | 16 +++++++++++++--- lib/nova | 5 +++-- stackrc | 6 +++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/neutron_plugins/services/l3 b/lib/neutron_plugins/services/l3 index 2180099ee4..61b8402818 100644 --- a/lib/neutron_plugins/services/l3 +++ b/lib/neutron_plugins/services/l3 @@ -102,10 +102,20 @@ function _configure_neutron_l3_agent { neutron_plugin_configure_l3_agent $Q_L3_CONF_FILE - _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" True False "inet" + # If we've given a PUBLIC_INTERFACE to take over, then we assume + # that we can own the whole thing, and privot it into the OVS + # bridge. If we are not, we're probably on a single interface + # machine, and we just setup NAT so that fixed guests can get out. + if [[ -n "$PUBLIC_INTERFACE" ]]; then + _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" True False "inet" - if [[ $(ip -f inet6 a s dev "$PUBLIC_INTERFACE" | grep -c 'global') != 0 ]]; then - _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" False False "inet6" + if [[ $(ip -f inet6 a s dev "$PUBLIC_INTERFACE" | grep -c 'global') != 0 ]]; then + _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" False False "inet6" + fi + else + local default_dev="" + default_dev=$(ip route | grep ^default | awk '{print $5}') + sudo iptables -t nat -A POSTROUTING -o $default_dev -s $FLOATING_RANGE -j MASQUERADE fi } diff --git a/lib/nova b/lib/nova index 16f6e9b39f..1369c409fc 100644 --- a/lib/nova +++ b/lib/nova @@ -128,7 +128,7 @@ fi # -------------------------- NETWORK_MANAGER=${NETWORK_MANAGER:-${NET_MAN:-FlatDHCPManager}} -PUBLIC_INTERFACE=${PUBLIC_INTERFACE:-$PUBLIC_INTERFACE_DEFAULT} + VLAN_INTERFACE=${VLAN_INTERFACE:-$GUEST_INTERFACE_DEFAULT} FLAT_NETWORK_BRIDGE=${FLAT_NETWORK_BRIDGE:-$FLAT_NETWORK_BRIDGE_DEFAULT} @@ -659,8 +659,9 @@ function create_nova_cache_dir { } function create_nova_conf_nova_network { + local public_interface=${PUBLIC_INTERFACE:-$PUBLIC_INTERFACE_DEFAULT} iniset $NOVA_CONF DEFAULT network_manager "nova.network.manager.$NETWORK_MANAGER" - iniset $NOVA_CONF DEFAULT public_interface "$PUBLIC_INTERFACE" + iniset $NOVA_CONF DEFAULT public_interface "$public_interface" iniset $NOVA_CONF DEFAULT vlan_interface "$VLAN_INTERFACE" iniset $NOVA_CONF DEFAULT flat_network_bridge "$FLAT_NETWORK_BRIDGE" if [ -n "$FLAT_INTERFACE" ]; then diff --git a/stackrc b/stackrc index acb7d3f650..f42bd944fa 100644 --- a/stackrc +++ b/stackrc @@ -70,11 +70,13 @@ if ! isset ENABLED_SERVICES ; then # Keystone - nothing works without keystone ENABLED_SERVICES=key # Nova - services to support libvirt based openstack clouds - ENABLED_SERVICES+=,n-api,n-cpu,n-net,n-cond,n-sch,n-novnc,n-cauth + ENABLED_SERVICES+=,n-api,n-cpu,n-cond,n-sch,n-novnc,n-cauth # Glance services needed for Nova ENABLED_SERVICES+=,g-api,g-reg # Cinder ENABLED_SERVICES+=,c-sch,c-api,c-vol + # Neutron + ENABLED_SERVICES+=,q-svc,q-dhcp,q-meta,q-agt,q-l3 # Dashboard ENABLED_SERVICES+=,horizon # Additional services @@ -710,6 +712,8 @@ S3_SERVICE_PORT=${S3_SERVICE_PORT:-3333} PRIVATE_NETWORK_NAME=${PRIVATE_NETWORK_NAME:-"private"} PUBLIC_NETWORK_NAME=${PUBLIC_NETWORK_NAME:-"public"} +PUBLIC_INTERFACE="" + # Set default screen name SCREEN_NAME=${SCREEN_NAME:-stack}