From afe1b994ac029cf879c3cce552e244fa1cca2f7a Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Mon, 16 Oct 2017 11:21:18 +0100 Subject: [PATCH] Support additional options for neutron generic switch driver config Allows kolla_neutron_ml2_generic_switch_extra to define a dict of additional config options to add to per-switch configuration for the neutron ML2 generic switch driver. These options may be switch host-specific. --- ansible/group_vars/all/neutron | 6 ++++++ ansible/kolla-openstack.yml | 2 +- ansible/roles/kolla-openstack/templates/ml2_conf.ini.j2 | 6 ++++-- etc/kayobe/neutron.yml | 9 +++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ansible/group_vars/all/neutron b/ansible/group_vars/all/neutron index 528e10049..3282f51cd 100644 --- a/ansible/group_vars/all/neutron +++ b/ansible/group_vars/all/neutron @@ -59,3 +59,9 @@ kolla_neutron_ml2_generic_switch_hosts: [] # switch_interface_config variable for each switch to determine which # interfaces should be configured. kolla_neutron_ml2_generic_switch_trunk_port_hosts: "{{ groups['network'] }}" + +# Dict containing additional configuration for switches managed by the +# genericswitch ML2 mechanism driver. For per-switch configuration of switches +# in kolla_neutron_ml2_generic_switch_hosts, this may be set as a group or +# host variable for the switch host. +kolla_neutron_ml2_generic_switch_extra: {} diff --git a/ansible/kolla-openstack.yml b/ansible/kolla-openstack.yml index be5a62b8c..bd2d0b105 100644 --- a/ansible/kolla-openstack.yml +++ b/ansible/kolla-openstack.yml @@ -135,7 +135,7 @@ 'ngs_trunk_ports': ( hostvars[item].switch_interface_config | switch_interface_config_select_description(kolla_neutron_ml2_generic_switch_trunk_port_hosts)).keys() | join(',') - }] + } | combine(hostvars[item].kolla_neutron_ml2_generic_switch_extra) ] }} with_items: "{{ kolla_neutron_ml2_generic_switch_hosts }}" diff --git a/ansible/roles/kolla-openstack/templates/ml2_conf.ini.j2 b/ansible/roles/kolla-openstack/templates/ml2_conf.ini.j2 index c6e762200..1e49ae17a 100644 --- a/ansible/roles/kolla-openstack/templates/ml2_conf.ini.j2 +++ b/ansible/roles/kolla-openstack/templates/ml2_conf.ini.j2 @@ -28,9 +28,11 @@ key_file = {{ switch.key_file }} {% if switch.secret is defined %} secret = {{ switch.secret }} {% endif %} -{% if switch.ngs_trunk_ports is defined %} -ngs_trunk_ports = {{ switch.ngs_trunk_ports }} +{% for key, value in switch.items() %} +{% if key.startswith('ngs_') %} +{{ key }} = {{ value }} {% endif %} +{% endfor %} {% endfor %} diff --git a/etc/kayobe/neutron.yml b/etc/kayobe/neutron.yml index 190bc6307..d295a966c 100644 --- a/etc/kayobe/neutron.yml +++ b/etc/kayobe/neutron.yml @@ -21,6 +21,9 @@ # List of Neutron ML2 extention drivers to use. #kolla_neutron_ml2_extension_drivers: +############################################################################### +# Neutron ML2 generic switch driver configuration. + # List of switches to configure for use by genericswitch ML2 mechanism driver. # Each item should be a dict containing the following items: # name: Hostname of the switch @@ -43,6 +46,12 @@ # secret: not currently supported #kolla_neutron_ml2_generic_switch_hosts: +# Dict containing additional configuration for switches managed by the +# genericswitch ML2 mechanism driver. For per-switch configuration of switches +# in kolla_neutron_ml2_generic_switch_hosts, this may be set as a group or +# host variable for the switch host. +#kolla_neutron_ml2_generic_switch_extra: + ############################################################################### # Dummy variable to allow Ansible to accept this file. workaround_ansible_issue_8743: yes