9b7cab9cf1
This commit provides baseline changes to the os_neutron role to support DPDK-accelerated Open vSwitch. Change-Id: I08aba431d1546160e7c0311ad929762a018e0dca Implements: dpdk support for openvswitch Closes-Bug: #1784660
128 lines
4.8 KiB
YAML
128 lines
4.8 KiB
YAML
---
|
|
# (c) 2019, James Denton <james.denton@outlook.com>
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: Set alternative ovs-vswitchd service
|
|
alternatives:
|
|
name: ovs-vswitchd
|
|
path: /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk
|
|
when:
|
|
- ansible_pkg_mgr in ['apt']
|
|
- neutron_services['neutron-openvswitch-agent']['group'] in group_names
|
|
- '"nova_compute" in group_names'
|
|
|
|
- name: Configure DPDK interface to driver bindings
|
|
template:
|
|
src: dpdk_interfaces.j2
|
|
dest: "/etc/dpdk/interfaces"
|
|
owner: "root"
|
|
group: "root"
|
|
when:
|
|
- neutron_services['neutron-openvswitch-agent']['group'] in group_names
|
|
- '"nova_compute" in group_names'
|
|
|
|
- name: Configure DPDK hugepage allocation
|
|
template:
|
|
src: dpdk.conf.j2
|
|
dest: "/etc/dpdk/dpdk.conf"
|
|
owner: "root"
|
|
group: "root"
|
|
when:
|
|
- neutron_services['neutron-openvswitch-agent']['group'] in group_names
|
|
- '"nova_compute" in group_names'
|
|
|
|
- name: Ensure DPDK service is started and enabled
|
|
systemd:
|
|
name: "{{ dpdk_service_name }}"
|
|
state: restarted
|
|
enabled: yes
|
|
when:
|
|
- neutron_services['neutron-openvswitch-agent']['group'] in group_names
|
|
- '"nova_compute" in group_names'
|
|
|
|
- name: Ensure Open vSwitch service is started and enabled
|
|
systemd:
|
|
name: "{{ neutron_ovs_service_name }}"
|
|
state: restarted
|
|
enabled: yes
|
|
when:
|
|
- neutron_services['neutron-openvswitch-agent']['group'] in group_names
|
|
|
|
- name: Set DPDK lcore mask
|
|
command: "ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-lcore-mask={{ ovs_dpdk_lcore_mask }}"
|
|
when:
|
|
- neutron_services['neutron-openvswitch-agent']['group'] in group_names
|
|
- '"nova_compute" in group_names'
|
|
|
|
- name: Set DPDK PMD cpu mask
|
|
command: "ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask={{ ovs_dpdk_pmd_cpu_mask }}"
|
|
when:
|
|
- neutron_services['neutron-openvswitch-agent']['group'] in group_names
|
|
- '"nova_compute" in group_names'
|
|
|
|
- name: Set DPDK socket memory
|
|
command: "ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-socket-mem={{ ovs_dpdk_socket_mem }}"
|
|
when:
|
|
- neutron_services['neutron-openvswitch-agent']['group'] in group_names
|
|
- '"nova_compute" in group_names'
|
|
|
|
- name: Enable DPDK support for openvswitch
|
|
command: "ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true"
|
|
when:
|
|
- neutron_services['neutron-openvswitch-agent']['group'] in group_names
|
|
- '"nova_compute" in group_names'
|
|
|
|
# (jamesdenton) Should replace hard dir with var, and only do this on computes
|
|
- name: Create vhost_socket directory
|
|
file:
|
|
path: /var/lib/vhost_socket
|
|
state: directory
|
|
owner: libvirt-qemu
|
|
group: "{{ vhost_socket_directory_group }}"
|
|
mode: "0755"
|
|
when:
|
|
- neutron_services['neutron-openvswitch-agent']['group'] in group_names
|
|
- '"nova_compute" in group_names'
|
|
|
|
# NOTE: This needs to be netdev for compute and system for network node
|
|
# Should I set an override for network nodes (non-dpdk)to default 'system' rather than 'netdev'?
|
|
- name: Setup Network Provider Bridges
|
|
openvswitch_bridge:
|
|
bridge: "{{ bridge_mapping.split(':')[1] }}"
|
|
set: "bridge {{ bridge_mapping.split(':')[1] }} datapath_type={{ ovs_datapath }}"
|
|
fail_mode: secure
|
|
state: present
|
|
with_items: "{{ neutron_provider_networks.network_mappings.split(',') }}"
|
|
loop_control:
|
|
loop_var: bridge_mapping
|
|
when:
|
|
- neutron_services['neutron-openvswitch-agent']['group'] in group_names
|
|
- neutron_plugin_type in ['ml2.ovs', 'ml2.ovs.dvr']
|
|
- neutron_provider_networks.network_mappings is defined
|
|
|
|
# (todo) Loop thru ints or build a bond with ints. TBD.
|
|
- name: Add ports to Network Provider Bridges
|
|
openvswitch_port:
|
|
bridge: "{{ interface_mapping.split(':')[0] }}"
|
|
port: "{{ interface_mapping.split(':',1)[1] }}"
|
|
set: "Interface {{ interface_mapping.split(':',1)[1] }} type=dpdk options:dpdk-devargs='{{ interface_mapping.split(':',1)[1] }}'"
|
|
state: present
|
|
with_items: "{{ neutron_provider_networks.network_interface_mappings.split(',') }}"
|
|
loop_control:
|
|
loop_var: interface_mapping
|
|
when:
|
|
- neutron_services['neutron-openvswitch-agent']['group'] in group_names
|
|
- neutron_plugin_type in ['ml2.ovs', 'ml2.ovs.dvr']
|
|
- neutron_provider_networks.network_interface_mappings is defined and (neutron_provider_networks.network_interface_mappings|length > 0)
|