Add LBaaS v2 support

This patch adds tasks to deploy the LBaaS v2 agent along with
its related service and configuration files. Deployers can
move between LBaaS v1 and v2 at any time. The tasks will ensure
that the correct agent is running based on the deployer's
neutron_plugins_base variable.

Both agents could possibly run simultaneously for a short period
of time, but that will be cleaned up by the tasks in
neutron_lbaas.yml.

This is a re-work of the changes proposed for OSA in
change I1c9c43582c99ebd1fb7bacb6545bcad34a692880.

Co-Authored-By: Bjoern Teipel <bjoern.teipel@rackspace.com>

Closes-bug: 1541130

Change-Id: I00b41634816a1f7f1dfb31fcc6f35050c8d223a4
This commit is contained in:
Major Hayden 2016-03-03 15:38:34 -06:00
parent c8237b3be8
commit 24b824b15c
8 changed files with 100 additions and 3 deletions

View File

@ -77,7 +77,7 @@ neutron_plugin_core: "{{ neutron_plugins[neutron_plugin_type].plugin_core }}"
# neutron_plugin_base:
# - neutron.services.l3_router.l3_router_plugin.L3RouterPlugin
# - neutron.services.metering.metering_plugin.MeteringPlugin
# - neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPlugin
# - neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2
# - neutron.services.vpn.plugin.VPNDriverPlugin
neutron_plugin_base:
- neutron.services.l3_router.l3_router_plugin.L3RouterPlugin
@ -156,6 +156,16 @@ neutron_services:
config_options: --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/lbaas_agent.ini
config_overrides: "{{ neutron_lbaas_agent_ini_overrides }}"
config_type: "ini"
neutron-lbaasv2-agent:
group: neutron_lbaas_agent
service_name: neutron-lbaasv2-agent
service_en: "{{ neutron_lbaasv2 }}"
service_conf: lbaas_agent.ini
service_group: neutron_agent
service_rootwrap: rootwrap.d/lbaas-haproxy.filters
config_options: --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/lbaas_agent.ini
config_overrides: "{{ neutron_lbaas_agent_ini_overrides }}"
config_type: "ini"
neutron-server:
group: neutron_server
service_name: neutron-server
@ -164,8 +174,13 @@ neutron_services:
config_options: "--config-file /etc/neutron/neutron.conf --config-file /etc/neutron/{{ neutron_plugins[neutron_plugin_type].plugin_ini }}"
## Neutron LBaaS
# Please add the LoadBalancerPlugin to the neutron_plugin_base list
# See documentation section titled "Configuring the Network Load Balacing
# Service (Optional)" for more details.
#
# To enable LBaaS v1, add LoadBalancerPlugin to neutron_plugin_base list.
# To enable LBaaS v2, add LoadBalancerPluginv2 to neutron_plugin_base list
neutron_lbaas: "{% if 'neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPlugin' in neutron_plugin_base %}True{% else %}False{% endif %}"
neutron_lbaasv2: "{% if 'neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2' in neutron_plugin_base %}True{% else %}False{% endif %}"
## Neutron L3
## Please add the L3RouterPlugin to the neutron_plugin_base list

View File

@ -13,10 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- include: neutron_check.yml
- include: neutron_pre_install.yml
- include: neutron_install.yml
- include: neutron_post_install.yml
- include: neutron_upstart_init.yml
- include: neutron_lbaas.yml
- include: neutron_db_setup.yml
when: >

23
tasks/neutron_check.yml Normal file
View File

@ -0,0 +1,23 @@
---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Ensure LBaaS v1 and v2 are not enabled simultaneously
fail:
message: |
LBaaS v1 and v2 cannot be enabled at the same time.
Verify that your neutron_plugin_base variable is correct.
when:
- neutron_lbaas | bool
- neutron_lbaasv2 | bool

View File

@ -54,7 +54,7 @@
with_items: neutron_lbaas_apt_packages
when:
- inventory_hostname in groups[neutron_services['neutron-lbaas-agent']['group']]
- neutron_lbaas | bool
- neutron_lbaas | bool or neutron_lbaasv2 | bool
tags:
- neutron-install
- neutron-apt-packages

35
tasks/neutron_lbaas.yml Normal file
View File

@ -0,0 +1,35 @@
---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# These tasks are here to handle a situation where a deployer has v1 deployed
# and then chooses to deploy v2 (or vice versa). The existing tasks within
# neutron_upstart_init.yml will deploy configuration files for both agents
# and both will be running on the system until these tasks run.
#
# These tasks will ensure that the correct agent is the only one running.
- name: Ensure LBaaS v1 agent is stopped when v2 is in neutron_plugins_base
service:
name: neutron-lbaas-agent
enabled: no
state: stopped
when: neutron_lbaasv2 | bool
- name: Ensure LBaaS v2 agent is stopped when v1 is in neutron_plugins_base
service:
name: neutron-lbaasv2-agent
enabled: no
state: stopped
when: neutron_lbaas | bool

View File

@ -110,3 +110,17 @@
- neutron_services['neutron-lbaas-agent'].service_en | bool
tags:
- upstart-init
- include: neutron_upstart_common_init.yml
vars:
program_name: "{{ neutron_services['neutron-lbaasv2-agent'].service_name }}"
program_config_options: "{{ neutron_services['neutron-lbaasv2-agent'].config_options }}"
service_name: "{{ neutron_service_name }}"
system_user: "{{ neutron_system_user_name }}"
system_group: "{{ neutron_system_group_name }}"
service_home: "{{ neutron_system_home_folder }}"
when:
- inventory_hostname in groups[neutron_services['neutron-lbaasv2-agent']['group']]
- neutron_services['neutron-lbaas-agent'].service_en | bool
tags:
- upstart-init

View File

@ -27,7 +27,11 @@ interface_driver = {{ neutron_driver_interface }}
# device_driver = path.to.provider1.driver.Driver
# device_driver = path.to.provider2.driver.Driver
# Default is:
{% if neutron_lbaas | bool %}
device_driver = neutron_lbaas.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver
{% elif neutron_lbaasv2 | bool %}
device_driver = neutron_lbaas.drivers.haproxy.namespace_driver.HaproxyNSDriver
{% endif %}
[haproxy]
# Location to store config and state files

View File

@ -157,7 +157,11 @@ pool_timeout = {{ neutron_db_pool_timeout }}
# Service providers
[service_providers]
{% if neutron_lbaas | bool %}
service_provider = LOADBALANCER:Haproxy:neutron_lbaas.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
{% elif neutron_lbaasv2 | bool %}
service_provider = LOADBALANCERV2:Haproxy:neutron_lbaas.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
{% endif %}
#service_provider = VPN:openswan:neutron.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default
{% endif %}