forked from Mirantis/openstack-lbaas
wpf500/openstack-lbaas
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is the OpenStack LBaaS project. * Project overview: https://docs.google.com/document/pub?id=1DRgQhZJ73EyzQ2KvzVQd7Li9YEL7fXWBp8reMdAEhiM * Screencast: http://www.youtube.com/watch?v=NgAL-kfdbtE * API draft: https://docs.google.com/document/pub?id=11WWy7MQN1RIK7XdvQtUwkC_EIrykEDproFy9Pekm3wI * Roadmap: https://docs.google.com/document/pub?id=1yJZXI0WfpAZKhHaLQu7LaxGLrs4REmn0a5bYVbvsCTQ Getting started with LBaaS DevBox ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LBaaS DevBox is Linux-based VM with pre-installed services to simplify development and testing. It can be downloaded from https://docs.google.com/open?id=0B1mJ0eQoi7tEZmlYWHVyUjA3dlk DevBox contents: * Ubuntu 12.04 Server 64-bit * LBaaS sources checked out at /home/developer/openstack-lbaas/ * HAProxy service * Lighttpd service for back-end emulation * utils: git, curl, vim, mc There are 2 users: * developer/swordfish for development purposes * user/swordfish for configuring haproxy service Get LBaaS sources ~~~~~~~~~~~~~~~~~ Log in as "developer". Then check-out new sources: # rm -rf openstack-lbaas # git clone https://github.com/Mirantis/openstack-lbaas.git Source code layout: * balancer - LBaaS core * api - API layer * common - common code and utils * core - LBaaS server core * db - DB layer * drivers - drivers for load balancers * haproxy - driver for HAProxy * tests * manual - manual tests for LBaaS API * unit - unit tests Initial Setup ~~~~~~~~~~~~~ 1. Create virtualenv that required for executing code and tests # cd openstack-lbaas # ./run_tests -V -f Note, virtualenv needs to be updated any time code dependencies are changed. Virtualenv is created in .venv folder 2. Initialize database # ./.venv/bin/python bin/balancer-api --dbsync The database is located in balancer.sqlite Run and Test ~~~~~~~~~~~~ 1. Run LBaaS: # ./.venv/bin/python ./bin/balancer-api --config-file etc/balancer-api-paste.ini --debug By default the server is started on port 8181 2. Add HA Proxy device to LBaaS database a) Create file createDeviceHAProxy with the following content: # cd balancer/tests/manual/ # cat CreateDeviceHAProxy { "name": "HAP-001", "type": "HAPROXY", "version": "1", "supports_ipv6": 0, "requires_vip_ip": 1, "has_acl": 1, "supports_vlan": 1, "ip": "192.168.19.245", "port": "22", "user": "user", "password": "swordfish", "capabilities": {"algorithms":"RoundRobin"} } Note, ip needs to be changed to the real one! Figure out it youself based on the output of ifconfig. b) Execute script: # ./CreateDev.sh HAProxy c) If all is right, the information about newly created device will be returned: {"device": {"name": "HAP-001", "has_acl": 1, "ip": "192.168.19.245", "requires_vip_ip": 1, "capabilities": {"algorithms": "RoundRobin"}, "id": "c1dfe0c69bff49d296fc0d613417efcf", "version": "1", "user": "user", "supports_ipv6": 0, "password": "swordfish", "type": "HAPROXY", "port": "22", "supports_vlan": 1}} Write out value for device/id, it will be used later for creating load balancer 3, Check that device is added in DB # ./listDev.sh 4. Create load balancer # cat createLBcommandHAProxy { "device_id": "c1dfe0c69bff49d296fc0d613417efcf", "name": "testLB001", "protocol": "HTTP", "transport": "TCP", "algorithm": "RoundRobin", "virtualIps": [ { "address": "0.0.0.0", "mask": "255.255.255.255", "type": "PUBLIC", "ipVersion": "IPv4", "port": "99", "ICMPreply": "True" } ], "nodes": [ { "address": "127.0.0.1", "type": "host", "port": "8001", "weight": "1", "minCon": "100", "maxCon": "1000", "rateBandwidth": "12", "rateConnection": "1000", "status": "INSERVICE", "condition": "ENABLED", "vm_instance": "RServer001", "vm_id": "0001-0001-0001-0001" }, { "address": "127.0.0.1", "type": "host", "port": "8002", "weight": "1", "minCon": "300", "maxCon": "400", "rateBandwidth": "12", "rateConnection": "1000", "status": "INSERVICE", "condition": "ENABLED", "vm_instance": "RServer002", "vm_id": "0002-0002-0002-0002" }, { "address": "127.0.0.1", "type": "host", "port": "8003", "weight": "1", "minCon": "300", "maxCon": "400", "rateBandwidth": "12", "rateConnection": "1000", "status": "INSERVICE", "condition": "ENABLED", "vm_instance": "RServer003", "vm_id": "0003-0003-0003-0003" } ], "healthMonitor": [ { "type": "ICMP", "delay": "15", "attemptsBeforeDeactivation": "6", "timeout": "20" }, { "type": "HTTP", "delay": "30", "attemptsBeforeDeactivation": "5", "timeout": "30", "method": "GET", "path": "/", "expected": "200-204" } ] } # ./createLB.sh HAProxy 5. Check the load balancer # curl http://localhost:99/ HAProxy should return different results upon page reload. There are 3 different pages / servers in the server farm.
About
Load balancing service for OpenStack
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Python 97.4%
- JavaScript 1.4%
- Shell 1.2%