0122ca1d65
This patch will allow you to setup DPDK bonds within a given OVS bridge using DPDK-accelerated interfaces. A new provider network key, network_bond_interfaces, and related keys, have been introduced. Co-Authored-By: James Denton <james.denton@rackspace.com> Change-Id: I3fc2846a0c2b6579e4cdb54c3a7c36620700cd44
150 lines
6.1 KiB
YAML
150 lines
6.1 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_facts['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"
|
|
mode: "0640"
|
|
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"
|
|
mode: "0640"
|
|
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: "{{ vhost_socket_directory_owner }}"
|
|
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
|
|
|
|
# Adds a single host interface to an OVS bridge
|
|
- 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)
|
|
|
|
# Adds a DPDK-accelerated bond interface to an OVS bridge
|
|
- name: Add Bonds to Network Provider Bridges
|
|
openvswitch.openvswitch.openvswitch_bond:
|
|
bridge: "{{ bond_interfaces_mapping.bridge }}"
|
|
port: "{{ bond_interfaces_mapping.bridge }}-dpdkbond"
|
|
interfaces: "{{ bond_interfaces_mapping.interfaces }}"
|
|
bond_mode: "{{ bond_interfaces_mapping.bond_mode | default('active-backup') }}"
|
|
lacp: "{{ bond_interfaces_mapping.lacp | default('off') }}"
|
|
bond_updelay: "{{ bond_interfaces_mapping.bond_updelay | default(100) }}"
|
|
bond_downdelay: "{{ bond_interfaces_mapping.bond_downdelay | default(100) }}"
|
|
set: "{% for interface in bond_interfaces_mapping.interfaces %}interface {{ interface }} type=dpdk options:dpdk-devargs='{{ interface }}'{% if not loop.last %},{% endif %}{% endfor %}"
|
|
state: present
|
|
with_items: "{{ neutron_provider_networks.network_bond_interfaces_mappings }}"
|
|
loop_control:
|
|
loop_var: bond_interfaces_mapping
|
|
when:
|
|
- neutron_services['neutron-openvswitch-agent']['group'] in group_names
|
|
- neutron_plugin_type in ['ml2.ovs', 'ml2.ovs.dvr']
|
|
- neutron_provider_networks.network_bond_interfaces_mappings is defined and (neutron_provider_networks.network_bond_interfaces_mappings|length > 0)
|