From a8f3dc671dbf99c98de7173747b6a8a07e708fb2 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Fri, 7 Oct 2016 17:20:21 +0300 Subject: [PATCH] Convert Neutron config to nested Change-Id: I6cde84fa3acf3a38d2a4323439dc76baf928696f --- service/files/defaults.yaml | 30 +++++++++++++++++------------- service/files/dhcp_agent.ini.j2 | 4 ++-- service/files/ml2_conf.ini.j2 | 22 +++++++++++----------- service/files/neutron.conf.j2 | 18 +++++++++--------- service/neutron-server.yaml | 16 ++++++++-------- service/openvswitch-db.yaml | 2 +- service/openvswitch-vswitchd.yaml | 2 +- 7 files changed, 49 insertions(+), 45 deletions(-) diff --git a/service/files/defaults.yaml b/service/files/defaults.yaml index db0f5b3..18ec18e 100644 --- a/service/files/defaults.yaml +++ b/service/files/defaults.yaml @@ -1,17 +1,21 @@ configs: - neutron_db_password: password - neutron_db_name: neutron - neutron_db_username: neutron - neutron_server_port: 9696 - neutron_bridge_name: "br-ex" - neutron_external_interface: "eth2" - neutron_logging_debug: false - neutron_plugin_agent: "openvswitch" - neutron_ovsdb_interface: "native" - neutron_ovsdb_connection: "unix:/run/openvswitch/db.sock" - enable_neutron_lbaas: false - enable_neutron_qos: false - ovs_db_loglevel: "info" + neutron: + db: + password: password + name: neutron + username: neutron + server_port: 9696 + bridge_name: "br-ex" + external_interface: "eth2" + logging_debug: false + plugin_agent: "openvswitch" + ovsdb: + interface: "native" + connection: "unix:/run/openvswitch/db.sock" + enable_lbaas: false + enable_qos: false + ovs_db: + loglevel: "info" sources: openstack/neutron: diff --git a/service/files/dhcp_agent.ini.j2 b/service/files/dhcp_agent.ini.j2 index 6ace26f..c017637 100644 --- a/service/files/dhcp_agent.ini.j2 +++ b/service/files/dhcp_agent.ini.j2 @@ -3,5 +3,5 @@ dnsmasq_config_file = /etc/neutron/dnsmasq.conf [ovs] -ovsdb_interface = {{ neutron_ovsdb_interface }} -ovsdb_connection = {{ neutron_ovsdb_connection }} +ovsdb_interface = {{ neutron.ovsdb.interface }} +ovsdb_connection = {{ neutron.ovsdb.connection }} diff --git a/service/files/ml2_conf.ini.j2 b/service/files/ml2_conf.ini.j2 index 82ad5c4..0f0aec0 100644 --- a/service/files/ml2_conf.ini.j2 +++ b/service/files/ml2_conf.ini.j2 @@ -4,13 +4,13 @@ type_drivers = flat,vlan,vxlan tenant_network_types = vxlan -{% if neutron_plugin_agent == "openvswitch" %} +{% if neutron.plugin_agent == "openvswitch" %} mechanism_drivers = openvswitch,l2population -{% elif neutron_plugin_agent == "linuxbridge" %} +{% elif neutron.plugin_agent == "linuxbridge" %} mechanism_drivers = linuxbridge,l2population {% endif %} -{% if enable_neutron_qos %} +{% if neutron.enable_qos %} extension_drivers = qos {% endif %} @@ -25,25 +25,25 @@ vni_ranges = 1:1000 vxlan_group = 239.1.1.1 [securitygroup] -{% if neutron_plugin_agent == "openvswitch" %} +{% if neutron.plugin_agent == "openvswitch" %} firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver -{% elif neutron_plugin_agent == "linuxbridge" %} +{% elif neutron.plugin_agent == "linuxbridge" %} firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver {% endif %} -{% if neutron_plugin_agent == "openvswitch" %} +{% if neutron.plugin_agent == "openvswitch" %} [agent] tunnel_types = vxlan l2_population = true arp_responder = true [ovs] -ovsdb_interface = {{ neutron_ovsdb_interface }} -ovsdb_connection = {{ neutron_ovsdb_connection }} -bridge_mappings = physnet1:{{ neutron_bridge_name }} -{% elif neutron_plugin_agent == "linuxbridge" %} +ovsdb_interface = {{ neutron.ovsdb.interface }} +ovsdb_connection = {{ neutron.ovsdb.connection }} +bridge_mappings = physnet1:{{ neutron.bridge_name }} +{% elif neutron.plugin_agent == "linuxbridge" %} [linux_bridge] -physical_interface_mappings = physnet1:{{ neutron_external_interface }} +physical_interface_mappings = physnet1:{{ neutron.external_interface }} [vxlan] diff --git a/service/files/neutron.conf.j2 b/service/files/neutron.conf.j2 index 12a6d98..da30580 100644 --- a/service/files/neutron.conf.j2 +++ b/service/files/neutron.conf.j2 @@ -1,29 +1,29 @@ # neutron.conf [DEFAULT] -debug = {{ neutron_logging_debug }} +debug = {{ neutron.logging_debug }} use_stderr = True use_syslog = False bind_host = {{ network_topology["private"]["address"] }} -bind_port = {{ neutron_server_port }} +bind_port = {{ neutron.server_port }} api_paste_config = /usr/share/neutron/api-paste.ini endpoint_type = internalURL metadata_proxy_socket = /var/lib/neutron/ccp/metadata_proxy -{% if neutron_plugin_agent == "openvswitch" %} +{% if neutron.plugin_agent == "openvswitch" %} interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver -{% elif neutron_plugin_agent == "linuxbridge" %} +{% elif neutron.plugin_agent == "linuxbridge" %} interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver {% endif %} allow_overlapping_ips = true core_plugin = ml2 -service_plugins = router{% if enable_neutron_lbaas %},neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2{% endif %}{% if enable_neutron_qos %},qos{% endif %} +service_plugins = router{% if neutron.enable_lbaas %},neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2{% endif %}{% if neutron.enable_qos %},qos{% endif %} -{% if enable_neutron_lbaas %} +{% if neutron.enable_lbaas %} [service_providers] service_provider = LOADBALANCERV2:Haproxy:neutron_lbaas.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default {% endif %} @@ -54,7 +54,7 @@ rabbit_hosts = {{ address('rabbitmq') }}:{{ rabbitmq.port }} root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf [database] -connection = mysql+pymysql://{{ neutron_db_username }}:{{ neutron_db_password }}@{{ address('mariadb') }}/{{ neutron_db_name }} +connection = mysql+pymysql://{{ neutron.db.username }}:{{ neutron.db.password }}@{{ address('mariadb') }}/{{ neutron.db.name }} max_retries = -1 [keystone_authtoken] @@ -64,8 +64,8 @@ auth_type = password project_domain_id = default user_domain_id = default project_name = service -username = {{ neutron_db_username }} -password = {{ neutron_db_password }} +username = {{ neutron.db.username }} +password = {{ neutron.db.password }} memcached_servers = {{ address('memcached') }}:{{ memcached.port }} [oslo_messaging_notifications] diff --git a/service/neutron-server.yaml b/service/neutron-server.yaml index 6af6bf9..021a200 100644 --- a/service/neutron-server.yaml +++ b/service/neutron-server.yaml @@ -1,7 +1,7 @@ service: name: neutron-server ports: - - {{ neutron_server_port }} + - {{ neutron.server_port }} containers: - name: neutron-server image: neutron-server @@ -13,8 +13,8 @@ service: dependencies: - mariadb type: single - command: mysql -u root -p{{ db.root_password }} -h {{ address('mariadb') }} -e 'create database `{{ neutron_db_name }}`; - grant all privileges on `{{ neutron_db_name }}`.* to "{{ neutron_db_username }}"@"%" identified by "{{ neutron_db_password }}"' + command: mysql -u root -p{{ db.root_password }} -h {{ address('mariadb') }} -e 'create database `{{ neutron.db.name }}`; + grant all privileges on `{{ neutron.db.name }}`.* to "{{ neutron.db.username }}"@"%" identified by "{{ neutron.db.password }}"' - name: neutron-db-sync type: single command: neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head @@ -28,12 +28,12 @@ service: dependencies: - keystone-create-project type: single - command: openstack user create --project service --password {{ neutron_db_password }} {{ neutron_db_username }} + command: openstack user create --project service --password {{ neutron.db.password }} {{ neutron.db.username }} - name: neutron-role-add dependencies: - neutron-user-create type: single - command: openstack role add --project service --user {{ neutron_db_username }} admin + command: openstack role add --project service --user {{ neutron.db.username }} admin - name: neutron-service-create dependencies: - keystone @@ -43,17 +43,17 @@ service: dependencies: - neutron-service-create type: single - command: openstack endpoint create --region RegionOne network public http://{{ address('neutron-server') }}:{{ neutron_server_port }} + command: openstack endpoint create --region RegionOne network public http://{{ address('neutron-server') }}:{{ neutron.server_port }} - name: neutron-internal-endpoint-create dependencies: - neutron-service-create type: single - command: openstack endpoint create --region RegionOne network internal http://{{ address('neutron-server') }}:{{ neutron_server_port }} + command: openstack endpoint create --region RegionOne network internal http://{{ address('neutron-server') }}:{{ neutron.server_port }} - name: neutron-admin-endpoint-create dependencies: - neutron-service-create type: single - command: openstack endpoint create --region RegionOne network admin http://{{ address('neutron-server') }}:{{ neutron_server_port }} + command: openstack endpoint create --region RegionOne network admin http://{{ address('neutron-server') }}:{{ neutron.server_port }} daemon: command: neutron-server --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini files: diff --git a/service/openvswitch-db.yaml b/service/openvswitch-db.yaml index b7fd0ad..4408e69 100644 --- a/service/openvswitch-db.yaml +++ b/service/openvswitch-db.yaml @@ -19,7 +19,7 @@ service: - rabbitmq - neutron-db-sync daemon: - command: "/usr/sbin/ovsdb-server /etc/openvswitch/conf.db -vconsole:{{ ovs_db_loglevel }} --remote=punix:/run/openvswitch/db.sock" + command: "/usr/sbin/ovsdb-server /etc/openvswitch/conf.db -vconsole:{{ ovs_db.loglevel }} --remote=punix:/run/openvswitch/db.sock" files: - openvswitch-db-bootstrap.sh files: diff --git a/service/openvswitch-vswitchd.yaml b/service/openvswitch-vswitchd.yaml index f013e7e..1a0e476 100644 --- a/service/openvswitch-vswitchd.yaml +++ b/service/openvswitch-vswitchd.yaml @@ -27,7 +27,7 @@ service: - vswitchd-bootstrap - openvswitch-db - name: vswitchd-setup-ovs-bridge - command: /usr/local/bin/ovs-ensure-configured.sh {{ neutron_bridge_name }} {{ neutron_external_interface }} + command: /usr/local/bin/ovs-ensure-configured.sh {{ neutron.bridge_name }} {{ neutron.external_interface }} dependencies: - vswitchd-check-ovs-db daemon: