From 7f536f7e51bbb27a9a3cadb7a5ca73aeb10c190e Mon Sep 17 00:00:00 2001 From: Martin Magr Date: Mon, 3 Mar 2014 15:10:17 +0100 Subject: [PATCH] Fixed Neutron ML2 issues - Value of CONFIG_NEUTRON_ML2_VXLAN_GROUP is missing quotes which generates Puppet syntax error when it is used - Command 'neutron-db-manage upgrade' is run only on certain host, so race condition has to be set only on relevant host - In case of multihost installation Neutron API has to be available for OSCLIENT_HOST and HORIZON_HOST Fixes: rhbz#1066519, rhbz#1068962 Closes-bug: 1288447 Change-Id: I40a7cd0c3117152eac945ab26bf0b51e911a4765 --- packstack/plugins/neutron_350.py | 26 +++++++++++++++---- .../puppet/templates/neutron_ml2_plugin.pp | 22 +++++++++------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/packstack/plugins/neutron_350.py b/packstack/plugins/neutron_350.py index 881800992..a07cd4c75 100644 --- a/packstack/plugins/neutron_350.py +++ b/packstack/plugins/neutron_350.py @@ -583,7 +583,7 @@ def initSequences(controller): 'CONFIG_NEUTRON_ML2_VNI_RANGES'): config[key] = str([i.strip() for i in config[key].split(',') if i]) key = 'CONFIG_NEUTRON_ML2_VXLAN_GROUP' - config[key] = config[key] or 'undef' + config[key] = "'%s'" % config[key] if config[key] else 'undef' config['CONFIG_NEUTRON_L2_DBNAME'] = plugin_db config['CONFIG_NEUTRON_CORE_PLUGIN'] = plugin_path @@ -624,8 +624,14 @@ def create_manifests(config): service_plugins = [] if config['CONFIG_NEUTRON_LBAAS_HOSTS']: - lbp = 'neutron.services.loadbalancer.plugin.LoadBalancerPlugin' - service_plugins.append(lbp) + service_plugins.append( + 'neutron.services.loadbalancer.plugin.LoadBalancerPlugin' + ) + if config['CONFIG_NEUTRON_L2_PLUGIN'] == 'ml2': + # ML2 uses the L3 Router service plugin to implement l3 agent + service_plugins.append( + 'neutron.services.l3_router.l3_router_plugin.L3RouterPlugin' + ) config['SERVICE_PLUGINS'] = (str(service_plugins) if service_plugins else 'undef') @@ -638,6 +644,15 @@ def create_manifests(config): elif config['CONFIG_NEUTRON_L2_PLUGIN'] == 'ml2': plugin_manifest = 'neutron_ml2_plugin.pp' + # host to which allow neutron server + allowed_hosts = set(q_hosts) + if config['CONFIG_CLIENT_INSTALL'] == 'y': + allowed_hosts.add(config['CONFIG_OSCLIENT_HOST']) + if config['CONFIG_HORIZON_INSTALL'] == 'y': + allowed_hosts.add(config['CONFIG_HORIZON_HOST']) + if config['CONFIG_NOVA_INSTALL'] == 'y': + allowed_hosts.add(config['CONFIG_NOVA_API_HOST']) + for host in q_hosts: manifest_file = "%s_neutron.pp" % (host,) manifest_data = getManifestTemplate("neutron.pp") @@ -648,9 +663,10 @@ def create_manifests(config): manifest_file = "%s_neutron.pp" % (host,) manifest_data = getManifestTemplate("neutron_api.pp") # Firewall Rules - config['FIREWALL_ALLOWED'] = ",".join(["'%s'" % i for i in q_hosts]) + config['FIREWALL_ALLOWED'] = ",".join(["'%s'" % i + for i in allowed_hosts]) config['FIREWALL_SERVICE_NAME'] = "neutron" - config['FIREWALL_PORTS'] = "'9696','67','68'" + config['FIREWALL_PORTS'] = "'9696'" manifest_data += getManifestTemplate("firewall.pp") appendManifestFile(manifest_file, manifest_data, 'neutron') diff --git a/packstack/puppet/templates/neutron_ml2_plugin.pp b/packstack/puppet/templates/neutron_ml2_plugin.pp index 1ca216cfe..80b630bf0 100644 --- a/packstack/puppet/templates/neutron_ml2_plugin.pp +++ b/packstack/puppet/templates/neutron_ml2_plugin.pp @@ -17,14 +17,18 @@ if 'linuxbridge' in %(CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS)s and !defined(Packag } class { 'neutron::plugins::ml2': - type_drivers => %(CONFIG_NEUTRON_ML2_TYPE_DRIVERS)s, - tenant_network_types => %(CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES)s, - mechanism_drivers => %(CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS)s, - flat_networks => %(CONFIG_NEUTRON_ML2_FLAT_NETWORKS)s, - network_vlan_ranges => %(CONFIG_NEUTRON_ML2_VLAN_RANGES)s, - tunnel_id_ranges => %(CONFIG_NEUTRON_ML2_TUNNEL_ID_RANGES)s, - vxlan_group => %(CONFIG_NEUTRON_ML2_VXLAN_GROUP)s, - vni_ranges => %(CONFIG_NEUTRON_ML2_VNI_RANGES)s, + type_drivers => %(CONFIG_NEUTRON_ML2_TYPE_DRIVERS)s, + tenant_network_types => %(CONFIG_NEUTRON_ML2_TENANT_NETWORK_TYPES)s, + mechanism_drivers => %(CONFIG_NEUTRON_ML2_MECHANISM_DRIVERS)s, + flat_networks => %(CONFIG_NEUTRON_ML2_FLAT_NETWORKS)s, + network_vlan_ranges => %(CONFIG_NEUTRON_ML2_VLAN_RANGES)s, + tunnel_id_ranges => %(CONFIG_NEUTRON_ML2_TUNNEL_ID_RANGES)s, + vxlan_group => %(CONFIG_NEUTRON_ML2_VXLAN_GROUP)s, + vni_ranges => %(CONFIG_NEUTRON_ML2_VNI_RANGES)s, + enable_security_group => 'dummy', } -Neutron_plugin_ml2<||> -> File['/etc/neutron/plugin.ini'] -> Exec['neutron-db-manage upgrade'] +# For cases where "neutron-db-manage upgrade" command is called we need to fill config file first +if defined(Exec['neutron-db-manage upgrade']) { + Neutron_plugin_ml2<||> -> File['/etc/neutron/plugin.ini'] -> Exec['neutron-db-manage upgrade'] +}