Jump to: navigation, search


< Neutron‎ | LBaaS
Revision as of 03:23, 27 February 2013 by Markmcclain (talk | contribs) (Validation)

Getting the Code

Currently, both the quantum, python-quantumclient, and devstack code is under review. Please pull from the following reviews to get the latest code:

System Setup

sudo apt-get install haproxy

add the following lines to your localrc:

enable_service q-lbaas

then re-run stack.sh

Topology Setup

Spin up three VMs, two to be servers, and one to be a client.

nova boot --image <image-uuid> --flavor 1 server1
nova boot --image <image-uuid> --flavor 1 server2
nova boot --image <image-uuid> --flavor 1 client

Get the UUID of the private subnet.

quantum subnet-list

Create a Pool:

quantum lb-pool-create --lb-method ROUND_ROBIN --name mypool --protocol HTTP --subnet-id <subnet-id> 

Create Members (using the IPs of server1 and server2):

nova list 

quantum lb-member-create --address <server1-ip> --protocol-port 80 mypool
quantum lb-member-create --address <server2-ip> --protocol-port 80 mypool

Create a Healthmonitor and associated it with the pool:

quantum lb-healthmonitor-create --delay 3 --type HTTP --max-retries 3 --timeout 3
quantum lb-healthmonitor-associate <healthmonitor-uuid> mypool

Create a VIP

quantum lb-vip-create --name myvip --protocol-port 80 --protocol HTTP --subnet-id <subnet-id> mypool

note the address for use below.


We now have two hosts with a load balancer pointed at them, but those hosts are serving up any HTTP content.

A simple trick is to use netcat on the hosts to implement a simple webserver. For example, run:

while true; do echo -e 'HTTP/1.0 200 OK\r\n\r\n<servername>' | sudo nc -l -p 80 ; done 

replacing <servername> with "server1" and "server2" as appropriate. (If you have python installed, you can also create an index.html with the text "server1" or "server2" then in the same directory run: python -m SimpleHTTPServer)

From your client, use wget to make sure you can access server1 and server2 as expected.

wget -O - http://<server1-ip> 
wget -O - http://<server2-ip> 

Then use wget to hit the VIP IP several times in succession. You should bounce between seeing server1 and server2.

wget -O - http://<vip-ip> 
wget -O - http://<vip-ip> 
wget -O - http://<vip-ip> 
wget -O - http://<vip-ip> 

Full list of LBaaS CLI commands is available at Quantum/LBaaS/CLI


LBaas is implemented similar to L3 + DHCP using namespaces. You can use "ip netns list" to find the namespace named qlbaas-<pool_id>, and then test connectivity from that namespace.

Use "screen -x stack" to view the q-svc and q-lbaas tabs for errors.

Grep syslog for "haproxy" to see messages from Haproxy (though they are quite cryptic!)