Merge "eliminate TEST_ONLY differentiation"
diff --git a/doc/source/guides/devstack-with-lbaas-v2.rst b/doc/source/guides/devstack-with-lbaas-v2.rst
new file mode 100644
index 0000000..f679783
--- /dev/null
+++ b/doc/source/guides/devstack-with-lbaas-v2.rst
@@ -0,0 +1,99 @@
+Configure Load-Balancer in Kilo
+=================================
+
+The Kilo release of OpenStack will support Version 2 of the neutron load balancer. Until now, using OpenStack `LBaaS V2 <http://docs.openstack.org/api/openstack-network/2.0/content/lbaas_ext.html>`_ has required a good understanding of neutron and LBaaS architecture and several manual steps.
+
+
+Phase 1: Create DevStack + 2 nova instances
+--------------------------------------------
+
+First, set up a vm of your choice with at least 8 GB RAM and 16 GB disk space, make sure it is updated. Install git and any other developer tools you find useful.
+
+Install devstack
+
+ ::
+
+ git clone https://git.openstack.org/openstack-dev/devstack
+ cd devstack
+
+
+Edit your `local.conf` to look like
+
+ ::
+
+ [[local|localrc]]
+ # Load the external LBaaS plugin.
+ enable_plugin neutron-lbaas https://git.openstack.org/openstack/neutron-lbaas
+
+ # ===== BEGIN localrc =====
+ DATABASE_PASSWORD=password
+ ADMIN_PASSWORD=password
+ SERVICE_PASSWORD=password
+ SERVICE_TOKEN=password
+ RABBIT_PASSWORD=password
+ # Enable Logging
+ LOGFILE=$DEST/logs/stack.sh.log
+ VERBOSE=True
+ LOG_COLOR=True
+ SCREEN_LOGDIR=$DEST/logs
+ # Pre-requisite
+ ENABLED_SERVICES=rabbit,mysql,key
+ # Horizon
+ ENABLED_SERVICES+=,horizon
+ # Nova
+ ENABLED_SERVICES+=,n-api,n-crt,n-obj,n-cpu,n-cond,n-sch
+ IMAGE_URLS+=",https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img"
+ # Glance
+ ENABLED_SERVICES+=,g-api,g-reg
+ # Neutron
+ ENABLED_SERVICES+=,q-svc,q-agt,q-dhcp,q-l3,q-meta
+ # Enable LBaaS V2
+ ENABLED_SERVICES+=,q-lbaasv2
+ # Cinder
+ ENABLED_SERVICES+=,c-api,c-vol,c-sch
+ # Tempest
+ ENABLED_SERVICES+=,tempest
+ # ===== END localrc =====
+
+Run stack.sh and do some sanity checks
+
+ ::
+
+ ./stack.sh
+ . ./openrc
+
+ neutron net-list # should show public and private networks
+
+Create two nova instances that we can use as test http servers:
+
+ ::
+
+ #create nova instances on private network
+ nova boot --image $(nova image-list | awk '/ cirros-0.3.0-x86_64-disk / {print $2}') --flavor 1 --nic net-id=$(neutron net-list | awk '/ private / {print $2}') node1
+ nova boot --image $(nova image-list | awk '/ cirros-0.3.0-x86_64-disk / {print $2}') --flavor 1 --nic net-id=$(neutron net-list | awk '/ private / {print $2}') node2
+ nova list # should show the nova instances just created
+
+ #add secgroup rule to allow ssh etc..
+ neutron security-group-rule-create default --protocol icmp
+ neutron security-group-rule-create default --protocol tcp --port-range-min 22 --port-range-max 22
+ neutron security-group-rule-create default --protocol tcp --port-range-min 80 --port-range-max 80
+
+Set up a simple web server on each of these instances. ssh into each instance (username 'cirros', password 'cubswin:)') and run
+
+ ::
+
+ MYIP=$(ifconfig eth0|grep 'inet addr'|awk -F: '{print $2}'| awk '{print $1}')
+ while true; do echo -e "HTTP/1.0 200 OK\r\n\r\nWelcome to $MYIP" | sudo nc -l -p 80 ; done&
+
+Phase 2: Create your load balancers
+------------------------------------
+
+ ::
+
+ neutron lbaas-loadbalancer-create --name lb1 private-subnet
+ neutron lbaas-listener-create --loadbalancer lb1 --protocol HTTP --protocol-port 80 --name listener1
+ neutron lbaas-pool-create --lb-algorithm ROUND_ROBIN --listener listener1 --protocol HTTP --name pool1
+ neutron lbaas-member-create --subnet private-subnet --address 10.0.0.3 --protocol-port 80 pool1
+ neutron lbaas-member-create --subnet private-subnet --address 10.0.0.5 --protocol-port 80 pool1
+
+Please note here that the "10.0.0.3" and "10.0.0.5" in the above commands are the IPs of the nodes (in my test run-thru, they were actually 10.2 and 10.4), and the address of the created LB will be reported as "vip_address" from the lbaas-loadbalancer-create, and a quick test of that LB is "curl that-lb-ip", which should alternate between showing the IPs of the two nodes.
diff --git a/doc/source/index.rst b/doc/source/index.rst
index 0ffb15c..537f657 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -68,6 +68,7 @@
guides/neutron
guides/devstack-with-nested-kvm
guides/nova
+ guides/devstack-with-lbaas-v2
All-In-One Single VM
--------------------
diff --git a/files/venv-requirements.txt b/files/venv-requirements.txt
index e473a2f..73d0579 100644
--- a/files/venv-requirements.txt
+++ b/files/venv-requirements.txt
@@ -1,10 +1,11 @@
+# Once we can prebuild wheels before a devstack run, uncomment the skipped libraries
cryptography
-lxml
+# lxml # still install from from packages
MySQL-python
-netifaces
+# netifaces # still install from packages
#numpy # slowest wheel by far, stop building until we are actually using the output
posix-ipc
-psycopg2
+# psycopg # still install from packages
pycrypto
pyOpenSSL
PyYAML
diff --git a/lib/neutron b/lib/neutron
index 5ff3921..89ed3cc 100755
--- a/lib/neutron
+++ b/lib/neutron
@@ -779,9 +779,41 @@
fi
}
+# _move_neutron_addresses_route() - Move the primary IP to the OVS bridge
+# on startup, or back to the public interface on cleanup
+function _move_neutron_addresses_route {
+ local from_intf=$1
+ local to_intf=$2
+ local add_ovs_port=$3
+
+ if [[ -n "$from_intf" && -n "$to_intf" ]]; then
+ # Remove the primary IP address from $from_intf and add it to $to_intf,
+ # along with the default route, if it exists. Also, when called
+ # on configure we will also add $from_intf as a port on $to_intf,
+ # assuming it is an OVS bridge.
+
+ local IP_BRD=$(ip -4 a s dev $from_intf | awk '/inet/ { print $2, $3, $4; exit }')
+ local DEFAULT_ROUTE_GW=$(ip r | awk "/default.+$from_intf/ { print \$3; exit }")
+ local ADD_OVS_PORT=""
+
+ if [ "$DEFAULT_ROUTE_GW" != "" ]; then
+ ADD_DEFAULT_ROUTE="sudo ip r replace default via $DEFAULT_ROUTE_GW dev $to_intf"
+ fi
+
+ if [[ "$add_ovs_port" == "True" ]]; then
+ ADD_OVS_PORT="sudo ovs-vsctl add-port $to_intf $from_intf"
+ fi
+
+ sudo ip addr del $IP_BRD dev $from_intf; sudo ip addr add $IP_BRD dev $to_intf; $ADD_OVS_PORT; $ADD_DEFAULT_ROUTE
+ fi
+}
+
# cleanup_neutron() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_neutron {
+
+ _move_neutron_addresses_route "$OVS_PHYSICAL_BRIDGE" "$PUBLIC_INTERFACE" False
+
if is_provider_network && is_ironic_hardware; then
for IP in $(ip addr show dev $OVS_PHYSICAL_BRIDGE | grep ' inet ' | awk '{print $2}'); do
sudo ip addr del $IP dev $OVS_PHYSICAL_BRIDGE
@@ -956,6 +988,8 @@
_neutron_setup_interface_driver $Q_L3_CONF_FILE
neutron_plugin_configure_l3_agent
+
+ _move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" True
}
function _configure_neutron_metadata_agent {
@@ -1227,8 +1261,10 @@
if is_neutron_ovs_base_plugin && [[ "$Q_USE_NAMESPACE" = "True" ]]; then
local ext_gw_interface=$(_neutron_get_ext_gw_interface)
local cidr_len=${FLOATING_RANGE#*/}
- sudo ip addr add $ext_gw_ip/$cidr_len dev $ext_gw_interface
- sudo ip link set $ext_gw_interface up
+ if [[ $(ip addr show dev $ext_gw_interface | grep -c $ext_gw_ip) == 0 && $Q_USE_PROVIDERNET_FOR_PUBLIC == "False" ]]; then
+ sudo ip addr add $ext_gw_ip/$cidr_len dev $ext_gw_interface
+ sudo ip link set $ext_gw_interface up
+ fi
ROUTER_GW_IP=`neutron port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' -v subnet_id=$PUB_SUBNET_ID '$4 == subnet_id { print $8; }'`
die_if_not_set $LINENO ROUTER_GW_IP "Failure retrieving ROUTER_GW_IP"
sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP