From 296ddbeb035c6f582b316f066fe2ddffece07aca Mon Sep 17 00:00:00 2001 From: Vladislav Belogrudov Date: Wed, 31 May 2017 17:23:12 +0300 Subject: [PATCH] Add possibility to configure tenant network types and type drivers This patch add configuration options for tenant network types and type drivers. Both lists are checked so that tenant types are listed in drivers. For ironic 'flat' driver is mandatory and is added explicitly into ironic prechecks. Change-Id: Ie5775001165412910a258cbed2d2ebbb8ebbd879 Closes-Bug: #1694725 --- ansible/group_vars/all.yml | 5 +++++ ansible/roles/ironic/tasks/precheck.yml | 6 ++++++ ansible/roles/neutron/tasks/precheck.yml | 10 ++++++++++ ansible/roles/neutron/templates/ml2_conf.ini.j2 | 12 ++---------- doc/hyperv-guide.rst | 6 ++++++ doc/ironic-guide.rst | 15 +++++++++++++++ ...ble-tenant-network-types-4dd6ad35df8e8c6c.yaml | 13 +++++++++++++ 7 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 releasenotes/notes/configurable-tenant-network-types-4dd6ad35df8e8c6c.yaml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index ff9fae3df5..3cb1d34b05 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -517,6 +517,11 @@ designate_ns_record: "sample.openstack.org" ####################### neutron_bgp_router_id: "1.1.1.1" neutron_bridge_name: "br-ex" +# Comma-separated type of enabled ml2 type drivers +neutron_type_drivers: "flat,vlan,vxlan" +# Comma-separated types of tenant networks (should be listed in 'neutron_type_drivers') +# NOTE: for ironic this list should also contain 'flat' +neutron_tenant_network_types: "vxlan" ####################### # Nova options diff --git a/ansible/roles/ironic/tasks/precheck.yml b/ansible/roles/ironic/tasks/precheck.yml index 2bf0a4a664..8a1b476bb4 100644 --- a/ansible/roles/ironic/tasks/precheck.yml +++ b/ansible/roles/ironic/tasks/precheck.yml @@ -38,3 +38,9 @@ with_items: - "ironic-agent.kernel" - "ironic-agent.initramfs" + +- name: Looking for 'flat' in tenant network types + local_action: fail msg="'flat' is not in neutron_tenant_network_types [{{ neutron_tenant_network_types }}]" + changed_when: false + when: tenant_network_types.find('flat') == -1 + run_once: true diff --git a/ansible/roles/neutron/tasks/precheck.yml b/ansible/roles/neutron/tasks/precheck.yml index e14cf9ba59..f5329462b6 100644 --- a/ansible/roles/neutron/tasks/precheck.yml +++ b/ansible/roles/neutron/tasks/precheck.yml @@ -36,3 +36,13 @@ or inventory_hostname in groups['neutron-l3-agent'] or inventory_hostname in groups['neutron-metadata-agent']) - ansible_os_family == 'RedHat' or ansible_distribution == 'Ubuntu' + +- name: Checking tenant network types + vars: + type_drivers: "{{ neutron_type_drivers.replace(' ', '').split(',') | reject('equalto', '') | list }}" + tenant_network_types: "{{ neutron_tenant_network_types.replace(' ', '').split(',') | reject('equalto', '') | list }}" + local_action: fail msg="Tenant network type '{{ item }}' is not in type drivers [{{ neutron_type_drivers }}]" + changed_when: false + when: item not in type_drivers + run_once: true + with_items: "{{ tenant_network_types }}" diff --git a/ansible/roles/neutron/templates/ml2_conf.ini.j2 b/ansible/roles/neutron/templates/ml2_conf.ini.j2 index ba7647deec..b3727ebaa9 100644 --- a/ansible/roles/neutron/templates/ml2_conf.ini.j2 +++ b/ansible/roles/neutron/templates/ml2_conf.ini.j2 @@ -1,16 +1,8 @@ # ml2_conf.ini [ml2] -{% if enable_ironic | bool %} -tenant_network_types = vxlan, flat -mechanism_drivers = openvswitch -{% elif enable_hyperv | bool %} -type_drivers = flat,vlan,vxlan -tenant_network_types = flat,vlan -{% else %} # Changing type_drivers after bootstrap can lead to database inconsistencies -type_drivers = flat,vlan,vxlan -tenant_network_types = vxlan -{% endif %} +type_drivers = {{ neutron_type_drivers }} +tenant_network_types = {{ neutron_tenant_network_types }} {% if neutron_plugin_agent == "openvswitch" %} {% if enable_hyperv | bool %} diff --git a/doc/hyperv-guide.rst b/doc/hyperv-guide.rst index 8ff966c54c..42fc0898c6 100644 --- a/doc/hyperv-guide.rst +++ b/doc/hyperv-guide.rst @@ -94,6 +94,12 @@ Hyper-V options are also required in ``/etc/kolla/globals.yml``: vswitch_name: nova_msi_url: "https://www.cloudbase.it/downloads/HyperVNovaCompute_Beta.msi" +If tenant networks are to be built using VLAN add corresponding type in ``/etc/kolla/globals.yml``: + +.. code-block:: console + + neutron_tenant_network_types: 'flat,vlan' + The virtual switch is the same one created on the HyperV setup part. For nova_msi_url, different Nova MSI (Mitaka/Newton/Ocata) versions can be found on `Cloudbase website diff --git a/doc/ironic-guide.rst b/doc/ironic-guide.rst index 13dff7d965..08ffcd824e 100644 --- a/doc/ironic-guide.rst +++ b/doc/ironic-guide.rst @@ -20,6 +20,21 @@ The Ironic implementation is "tech preview", so currently instances can only be deployed on baremetal. Further work will be done to allow scheduling for both virtualized and baremetal deployments. +Pre-deployment Configuration +============================ + +Enable Ironic role in ``/etc/kolla/globals.yml``: + +.. code-block:: console + + enable_ironic: "yes" + +Beside that an additional network type 'flat' has to be added to a list of tenant network types: + +.. code-block:: console + + neutron_tenant_network_types: "vxlan,flat" + Configuring Web Console ======================= Configuration based off upstream web_console_documentation_. diff --git a/releasenotes/notes/configurable-tenant-network-types-4dd6ad35df8e8c6c.yaml b/releasenotes/notes/configurable-tenant-network-types-4dd6ad35df8e8c6c.yaml new file mode 100644 index 0000000000..48ad48d7c5 --- /dev/null +++ b/releasenotes/notes/configurable-tenant-network-types-4dd6ad35df8e8c6c.yaml @@ -0,0 +1,13 @@ +--- +features: + - | + Allow users to set neutron type drivers and tenant network types. + These are configurable via 'neutron_type_drivers' and + 'neutron_tenant_network_types' variables correspondingly. + Tenant network types are checked against a list of type drivers. + Also 'flat' network type is checked in the lists for Ironic. +upgrade: + - | + Default neutron_tenant_network_types list consist of 'vxlan'. + Ironic users should add 'flat' to the list. Also for Hyper-V + the list should contain 'vlan'.