Add support for LBaaS agent

This patch adds support for installing and configuring the LBaaS agent
on one or more hosts. At this time we only support haproxy. The default
value is empty list, in which case LBaaS will not be configured.

Change-Id: I172dce2b2d9b1841a9a8e8fe290b766674020c4e
This commit is contained in:
Ryan O'Hara
2013-11-12 12:35:29 -06:00
parent be5b63b4ff
commit 22b8b57ef5
3 changed files with 37 additions and 2 deletions

View File

@@ -101,6 +101,18 @@ def initConfig(controllerObject):
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "neutron-lbaas-hosts",
"USAGE" : "A comma separated list of IP addresses on which to install Neutron LBaaS agent",
"PROMPT" : "Enter a comma separated list of IP addresses on which to install Neutron LBaaS agent",
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_multi_ssh],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_NEUTRON_LBAAS_HOSTS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "neutron-l2-plugin",
"USAGE" : "The name of the L2 plugin to be used with Neutron",
"PROMPT" : "Enter the name of the L2 plugin to be used with Neutron",
@@ -316,10 +328,11 @@ def initSequences(controller):
controller.CONF['CONFIG_NEUTRON_L2_DBNAME'] = 'neutron_linux_bridge'
controller.CONF['CONFIG_NEUTRON_CORE_PLUGIN'] = 'neutron.plugins.linuxbridge.lb_neutron_plugin.LinuxBridgePluginV2'
global api_hosts, l3_hosts, dhcp_hosts, compute_hosts, meta_hosts, q_hosts
global api_hosts, l3_hosts, dhcp_hosts, lbaas_hosts, meta_hosts, compute_hosts, q_hosts
api_hosts = split_hosts(controller.CONF['CONFIG_NEUTRON_SERVER_HOST'])
l3_hosts = split_hosts(controller.CONF['CONFIG_NEUTRON_L3_HOSTS'])
dhcp_hosts = split_hosts(controller.CONF['CONFIG_NEUTRON_DHCP_HOSTS'])
lbaas_hosts = split_hosts(controller.CONF['CONFIG_NEUTRON_LBAAS_HOSTS'])
meta_hosts = split_hosts(controller.CONF['CONFIG_NEUTRON_METADATA_HOSTS'])
compute_hosts = set()
if controller.CONF['CONFIG_NOVA_INSTALL'] == 'y':
@@ -332,6 +345,7 @@ def initSequences(controller):
{'title': 'Adding Neutron L3 manifest entries', 'functions':[createL3Manifests]},
{'title': 'Adding Neutron L2 Agent manifest entries', 'functions':[createL2AgentManifests]},
{'title': 'Adding Neutron DHCP Agent manifest entries', 'functions':[createDHCPManifests]},
{'title': 'Adding Neutron LBaaS Agent manifest entries', 'functions':[createLBaaSManifests]},
{'title': 'Adding Neutron Metadata Agent manifest entries', 'functions':[createMetadataManifests]},
]
controller.addSequence("Installing OpenStack Neutron", [], [], neutron_steps)
@@ -340,6 +354,12 @@ def initSequences(controller):
def createManifest(config):
global q_hosts
service_plugins = []
if controller.CONF['CONFIG_NEUTRON_LBAAS_HOSTS']:
service_plugins.append("neutron.services.loadbalancer.plugin.LoadBalancerPlugin")
config['SERVICE_PLUGINS'] = ",".join(service_plugins)
for host in q_hosts:
manifest_file = "%s_neutron.pp" % (host,)
manifest_data = getManifestTemplate("neutron.pp")
@@ -397,6 +417,15 @@ def createDHCPManifests(config):
appendManifestFile(manifestfile, manifestdata + "\n")
def createLBaaSManifests(config):
global lbaas_hosts
for host in lbaas_hosts:
controller.CONF['CONFIG_NEUTRON_LBAAS_INTERFACE_DRIVER'] = getInterfaceDriver()
manifestdata = getManifestTemplate("neutron_lbaas.pp")
manifestfile = "%s_neutron.pp" % (host,)
appendManifestFile(manifestfile, manifestdata + "\n")
def get_values(val):
return [x.strip() for x in val.split(',')] if val else []

View File

@@ -15,5 +15,6 @@ class { 'neutron':
allow_overlapping_ips => true,
verbose => true,
qpid_port => '%(CONFIG_QPID_CLIENTS_PORT)s',
qpid_protocol => '%(CONFIG_QPID_PROTOCOL)s'
qpid_protocol => '%(CONFIG_QPID_PROTOCOL)s',
service_plugins => [ '%(SERVICE_PLUGINS)s' ]
}

View File

@@ -0,0 +1,5 @@
class { 'neutron::agents::lbaas':
interface_driver => '%(CONFIG_NEUTRON_LBAAS_INTERFACE_DRIVER)s',
device_driver => 'neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver',
user_group => 'haproxy',
}