Add support for quantum lbaas plugin.
Configure service_plugins and lbaas agent
in case q-lbaas service is enabled in localrc
Change-Id: Iebaa1ed6a7209175504230faf802a94dc841392f
| ... | ... |
@@ -176,6 +176,11 @@ fi |
| 176 | 176 |
# Please refer to lib/quantum_plugins/README.md for details. |
| 177 | 177 |
source $TOP_DIR/lib/quantum_plugins/$Q_PLUGIN |
| 178 | 178 |
|
| 179 |
+# Agent loadbalancer service plugin functions |
|
| 180 |
+# ------------------------------------------- |
|
| 181 |
+# Hardcoding for 1 service plugin for now |
|
| 182 |
+source $TOP_DIR/lib/quantum_plugins/agent_loadbalancer |
|
| 183 |
+ |
|
| 179 | 184 |
# Entry Points |
| 180 | 185 |
# ------------ |
| 181 | 186 |
|
| ... | ... |
@@ -185,6 +190,10 @@ function configure_quantum() {
|
| 185 | 185 |
_configure_quantum_common |
| 186 | 186 |
iniset_rpc_backend quantum $QUANTUM_CONF DEFAULT |
| 187 | 187 |
|
| 188 |
+ # goes before q-svc to init Q_SERVICE_PLUGIN_CLASSES |
|
| 189 |
+ if is_service_enabled q-lbaas; then |
|
| 190 |
+ _configure_quantum_lbaas |
|
| 191 |
+ fi |
|
| 188 | 192 |
if is_service_enabled q-svc; then |
| 189 | 193 |
_configure_quantum_service |
| 190 | 194 |
fi |
| ... | ... |
@@ -362,6 +371,10 @@ function start_quantum_agents() {
|
| 362 | 362 |
screen_it q-dhcp "python $AGENT_DHCP_BINARY --config-file $QUANTUM_CONF --config-file=$Q_DHCP_CONF_FILE" |
| 363 | 363 |
screen_it q-meta "python $AGENT_META_BINARY --config-file $QUANTUM_CONF --config-file=$Q_META_CONF_FILE" |
| 364 | 364 |
screen_it q-l3 "python $AGENT_L3_BINARY --config-file $QUANTUM_CONF --config-file=$Q_L3_CONF_FILE" |
| 365 |
+ |
|
| 366 |
+ if is_service_enabled q-lbaas; then |
|
| 367 |
+ screen_it q-lbaas "python $AGENT_LBAAS_BINARY --config-file $QUANTUM_CONF --config-file=$LBAAS_AGENT_CONF_FILENAME" |
|
| 368 |
+ fi |
|
| 365 | 369 |
} |
| 366 | 370 |
|
| 367 | 371 |
# stop_quantum() - Stop running processes (non-screen) |
| ... | ... |
@@ -483,6 +496,13 @@ function _configure_quantum_metadata_agent() {
|
| 483 | 483 |
_quantum_setup_keystone $Q_META_CONF_FILE DEFAULT set_auth_url |
| 484 | 484 |
} |
| 485 | 485 |
|
| 486 |
+function _configure_quantum_lbaas() |
|
| 487 |
+{
|
|
| 488 |
+ quantum_agent_lbaas_install_agent_packages |
|
| 489 |
+ quantum_agent_lbaas_configure_common |
|
| 490 |
+ quantum_agent_lbaas_configure_agent |
|
| 491 |
+} |
|
| 492 |
+ |
|
| 486 | 493 |
# _configure_quantum_plugin_agent() - Set config files for quantum plugin agent |
| 487 | 494 |
# It is called when q-agt is enabled. |
| 488 | 495 |
function _configure_quantum_plugin_agent() {
|
| ... | ... |
@@ -512,6 +532,10 @@ function _configure_quantum_service() {
|
| 512 | 512 |
# Update either configuration file with plugin |
| 513 | 513 |
iniset $QUANTUM_CONF DEFAULT core_plugin $Q_PLUGIN_CLASS |
| 514 | 514 |
|
| 515 |
+ if [[ $Q_SERVICE_PLUGIN_CLASSES != '' ]]; then |
|
| 516 |
+ iniset $QUANTUM_CONF DEFAULT service_plugins $Q_SERVICE_PLUGIN_CLASSES |
|
| 517 |
+ fi |
|
| 518 |
+ |
|
| 515 | 519 |
iniset $QUANTUM_CONF DEFAULT verbose True |
| 516 | 520 |
iniset $QUANTUM_CONF DEFAULT debug True |
| 517 | 521 |
iniset $QUANTUM_CONF DEFAULT state_path $DATA_DIR/quantum |
| 518 | 522 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,45 @@ |
| 0 |
+# Quantum loadbalancer plugin |
|
| 1 |
+# --------------------------- |
|
| 2 |
+ |
|
| 3 |
+# Save trace setting |
|
| 4 |
+MY_XTRACE=$(set +o | grep xtrace) |
|
| 5 |
+set +o xtrace |
|
| 6 |
+ |
|
| 7 |
+ |
|
| 8 |
+AGENT_LBAAS_BINARY="$QUANTUM_DIR/bin/quantum-lbaas-agent" |
|
| 9 |
+ |
|
| 10 |
+function quantum_agent_lbaas_install_agent_packages() {
|
|
| 11 |
+ if is_ubuntu || is_fedora; then |
|
| 12 |
+ install_package haproxy |
|
| 13 |
+ fi |
|
| 14 |
+} |
|
| 15 |
+ |
|
| 16 |
+function quantum_agent_lbaas_configure_common() {
|
|
| 17 |
+ if [[ $Q_SERVICE_PLUGIN_CLASSES == '' ]]; then |
|
| 18 |
+ Q_SERVICE_PLUGIN_CLASSES="quantum.plugins.services.agent_loadbalancer.plugin.LoadBalancerPlugin" |
|
| 19 |
+ else |
|
| 20 |
+ Q_SERVICE_PLUGIN_CLASSES="$Q_SERVICE_PLUGIN_CLASSES,quantum.plugins.services.agent_loadbalancer.plugin.LoadBalancerPlugin" |
|
| 21 |
+ fi |
|
| 22 |
+} |
|
| 23 |
+ |
|
| 24 |
+function quantum_agent_lbaas_configure_agent() {
|
|
| 25 |
+ LBAAS_AGENT_CONF_PATH=/etc/quantum/plugins/services/agent_loadbalancer |
|
| 26 |
+ mkdir -p $LBAAS_AGENT_CONF_PATH |
|
| 27 |
+ |
|
| 28 |
+ LBAAS_AGENT_CONF_FILENAME="$LBAAS_AGENT_CONF_PATH/lbaas_agent.ini" |
|
| 29 |
+ |
|
| 30 |
+ cp $QUANTUM_DIR/etc/lbaas_agent.ini /$LBAAS_AGENT_CONF_FILENAME |
|
| 31 |
+ |
|
| 32 |
+ if [[ $Q_PLUGIN == 'linuxbridge' || $Q_PLUGIN == 'brocade' ]]; then |
|
| 33 |
+ iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT interface_driver "quantum.agent.linux.interface.BridgeInterfaceDriver" |
|
| 34 |
+ else |
|
| 35 |
+ iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT interface_driver "quantum.agent.linux.interface.OVSInterfaceDriver" |
|
| 36 |
+ fi |
|
| 37 |
+ |
|
| 38 |
+ if is_fedora; then |
|
| 39 |
+ iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT user_group "nobody" |
|
| 40 |
+ fi |
|
| 41 |
+} |
|
| 42 |
+ |
|
| 43 |
+# Restore xtrace |
|
| 44 |
+$MY_XTRACE |