aboutsummaryrefslogtreecommitdiffstats
path: root/mcp/patches/salt-formula-linux
diff options
context:
space:
mode:
Diffstat (limited to 'mcp/patches/salt-formula-linux')
-rw-r--r--mcp/patches/salt-formula-linux/0001-Set-ovs-bridges-as-L3-interfaces.patch124
-rw-r--r--mcp/patches/salt-formula-linux/0002-network-Bring-in-basic-VPP-support.patch139
-rw-r--r--mcp/patches/salt-formula-linux/0003-OVS-Fix-Debian-service-deps-OVS-bridge-ifup.patch97
-rw-r--r--mcp/patches/salt-formula-linux/0004-dpdk-Handle-per-port-memory-model.patch25
-rw-r--r--mcp/patches/salt-formula-linux/0005-network-RHEL-Set-bridge-for-member-interfaces.patch44
-rw-r--r--mcp/patches/salt-formula-linux/0006-dpdk-Remove-invalid-vhost-options.patch25
6 files changed, 454 insertions, 0 deletions
diff --git a/mcp/patches/salt-formula-linux/0001-Set-ovs-bridges-as-L3-interfaces.patch b/mcp/patches/salt-formula-linux/0001-Set-ovs-bridges-as-L3-interfaces.patch
new file mode 100644
index 000000000..9479a990b
--- /dev/null
+++ b/mcp/patches/salt-formula-linux/0001-Set-ovs-bridges-as-L3-interfaces.patch
@@ -0,0 +1,124 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2019 Mirantis Inc., Enea AB and others.
+:
+: All rights reserved. This program and the accompanying materials
+: are made available under the terms of the Apache License, Version 2.0
+: which accompanies this distribution, and is available at
+: http://www.apache.org/licenses/LICENSE-2.0
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+From: Michael Polenchuk <mpolenchuk@mirantis.com>
+Date: Wed, 28 Feb 2018 17:54:28 +0400
+Subject: [PATCH] Set ovs bridges as L3 interfaces
+
+---
+ linux/files/ovs_bridge | 22 ++++++++++++++++++++++
+ linux/files/ovs_port | 8 +++++++-
+ linux/network/interface.sls | 34 +++++++++++++++++++++++++++++++++-
+ 3 files changed, 62 insertions(+), 2 deletions(-)
+ create mode 100644 linux/files/ovs_bridge
+
+diff --git a/linux/files/ovs_bridge b/linux/files/ovs_bridge
+new file mode 100644
+index 0000000..4718b91
+--- /dev/null
++++ b/linux/files/ovs_bridge
+@@ -0,0 +1,22 @@
++# With systemd, adding OVS bridges as 'auto' can cause race conditions
++# https://github.com/openvswitch/ovs/blob/master/debian/openvswitch-switch.README.Debian
++# auto {{ bridge_name }}
++allow-ovs {{ bridge_name }}
++iface {{ bridge_name }} inet {{ bridge.get('proto', 'static' if bridge.address is defined else 'manual') }}
++ ovs_type OVSBridge
++ {%- if bridge.address is defined %}
++ address {{ bridge.address }}
++ netmask {{ bridge.netmask }}
++ {%- endif %}
++ {%- if bridge.use_interfaces is defined %}
++ ovs_ports {{ bridge.use_interfaces|join(' ') }}
++ {%- endif %}
++ {%- if bridge.datapath_type is defined %}
++ ovs_extra set Bridge ${IFACE} datapath_type={{ bridge.datapath_type }}
++ {%- endif %}
++ {%- if bridge.gateway is defined %}
++ gateway {{ bridge.gateway }}
++ {%- endif %}
++ {%- if bridge.name_servers is defined %}
++ dns-nameservers {{ bridge.name_servers | join(' ') }}
++ {%- endif %}
+diff --git a/linux/files/ovs_port b/linux/files/ovs_port
+index 222ca8e..41821b7 100644
+--- a/linux/files/ovs_port
++++ b/linux/files/ovs_port
+@@ -1,6 +1,12 @@
+-auto {{ port_name }}
++# With systemd, adding OVS bridges as 'auto' can cause race conditions
++# https://github.com/openvswitch/ovs/blob/master/debian/openvswitch-switch.README.Debian
++# OVS ports will be automatically ifup-ed when ifup-ing the OVS bridge
++# auto {{ port_name }}
+ allow-{{ port.bridge }} {{ port_name }}
+ iface {{ port_name }} inet {{ port.get('proto', 'manual') }}
++{%- if '.' in port_name %}
++vlan-raw-device {{ port_name.split('.')[0] }}
++{%- endif %}
+ ovs_type {{ port.get('ovs_port_type', 'OVSIntPort') }}
+ mtu {{ port.get('mtu', '1500') }}
+ ovs_bridge {{ port.bridge }}
+diff --git a/linux/network/interface.sls b/linux/network/interface.sls
+index a39fc37..8bce092 100644
+--- a/linux/network/interface.sls
++++ b/linux/network/interface.sls
+@@ -92,6 +92,35 @@ add_int_{{ int_name }}_to_ovs_dpdk_bridge_{{ interface_name }}:
+ ovs_bridge_{{ interface_name }}:
+ openvswitch_bridge.present:
+ - name: {{ interface_name }}
++ file.managed:
++ - name: /etc/network/interfaces.u/ifcfg-{{ interface_name }}
++ - makedirs: True
++ - source: salt://linux/files/ovs_bridge
++ - defaults:
++ bridge: {{ interface|yaml }}
++ bridge_name: {{ interface_name }}
++ - template: jinja
++
++linux_interfaces_include_{{ interface_name }}:
++ file.prepend:
++ - name: /etc/network/interfaces
++ - text: |
++ source /etc/network/interfaces.d/*
++ # Workaround for Upstream-Bug: https://github.com/saltstack/salt/issues/40262
++ source /etc/network/interfaces.u/*
++
++ovs_bridge_up_{{ interface_name }}:
++ cmd.run:
++ - name: ifup --ignore-errors {{ interface_name }}
++ - require:
++ - file: ovs_bridge_{{ interface_name }}
++ - openvswitch_bridge: ovs_bridge_{{ interface_name }}
++ - file: linux_interfaces_final_include
++ {%- if network.noifupdown|d(false) or interface.noifupdown|d(false) %}
++ - onlyif: /bin/false
++ {%- else %}
++ - unless: grep -qFx up /sys/class/net/{{ interface_name }}/operstate
++ {%- endif %}
+
+ {# add linux network interface into OVS bridge #}
+ {%- for int_name, int in network.interface.items() %}
+@@ -102,7 +131,7 @@ ovs_bridge_{{ interface_name }}:
+
+ add_int_{{ int_name }}_to_ovs_bridge_{{ interface_name }}:
+ cmd.run:
+- - unless: ovs-vsctl show | grep {{ int_name }}
++ - unless: ovs-vsctl list-ports {{ interface_name }} | grep -qFx {{ int_name }}
+ - name: ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} add-port {{ interface_name }} {{ int_name }}
+
+ {%- endif %}
+@@ -176,6 +205,9 @@ ovs_port_{{ interface_name }}_line2:
+ ovs_port_up_{{ interface_name }}:
+ cmd.run:
+ - name: ifup {{ interface_name }}
++ {%- if network.noifupdown|d(false) or interface.noifupdown|d(false) %}
++ - onlyif: /bin/false
++ {%- endif %}
+ - require:
+ - file: ovs_port_{{ interface_name }}
+ - file: ovs_port_{{ interface_name }}_line1
diff --git a/mcp/patches/salt-formula-linux/0002-network-Bring-in-basic-VPP-support.patch b/mcp/patches/salt-formula-linux/0002-network-Bring-in-basic-VPP-support.patch
new file mode 100644
index 000000000..5166be56a
--- /dev/null
+++ b/mcp/patches/salt-formula-linux/0002-network-Bring-in-basic-VPP-support.patch
@@ -0,0 +1,139 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2019 Mirantis Inc., Enea AB and others.
+:
+: All rights reserved. This program and the accompanying materials
+: are made available under the terms of the Apache License, Version 2.0
+: which accompanies this distribution, and is available at
+: http://www.apache.org/licenses/LICENSE-2.0
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Mon, 10 Dec 2018 16:16:26 +0100
+Subject: [PATCH] network: Bring in basic VPP support
+
+For now, we only care about DPDK-backed VPP ports.
+
+TODO:
+- README.rst: VPP port usage
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ linux/files/vpp_commands.txt | 4 +++
+ linux/files/vpp_startup.conf | 47 ++++++++++++++++++++++++++++++++++++
+ linux/network/dpdk.sls | 38 +++++++++++++++++++++++++++++
+ 3 files changed, 89 insertions(+)
+ create mode 100644 linux/files/vpp_commands.txt
+ create mode 100644 linux/files/vpp_startup.conf
+
+diff --git a/linux/files/vpp_commands.txt b/linux/files/vpp_commands.txt
+new file mode 100644
+index 0000000..2ce4726
+--- /dev/null
++++ b/linux/files/vpp_commands.txt
+@@ -0,0 +1,4 @@
++{%- from "linux/map.jinja" import network with context %}
++{%- if network.vpp.commands is defined %}
++{{ network.vpp.commands }}
++{%- endif %}
+diff --git a/linux/files/vpp_startup.conf b/linux/files/vpp_startup.conf
+new file mode 100644
+index 0000000..fcfc1fd
+--- /dev/null
++++ b/linux/files/vpp_startup.conf
+@@ -0,0 +1,47 @@
++{%- from "linux/map.jinja" import network with context %}
++unix {
++ cli-listen /run/vpp/cli.sock
++ log /var/log/vpp.log
++ full-coredump
++ nodaemon
++ startup-config /etc/vpp/commands.txt
++{%- if network.vpp.gid is defined %}
++ gid {{ network.vpp.gid }}
++{%- endif %}
++}
++api-trace {
++ on
++}
++{%- if network.vpp.gid is defined %}
++api-segment {
++ gid {{ network.vpp.gid }}
++}
++{%- endif %}
++cpu {
++{%- if network.vpp.main_core is defined %}
++ main-core {{ network.vpp.main_core }}
++{%- endif %}
++{%- if network.vpp.corelist_workers is defined %}
++ corelist-workers {{ network.vpp.corelist_workers }}
++{%- endif %}
++{%- if network.vpp.skip_core is defined %}
++ skip-core {{ network.vpp.skip_core }}
++{%- endif %}
++{%- if network.vpp.workers is defined %}
++ workers {{ network.vpp.workers }}
++{%- endif %}
++}
++dpdk {
++{%- if network.vpp.decimal_interface_names is defined %}
++ decimal-interface-names
++{%- endif %}
++{%- if network.vpp.dpdk_socket_mem is defined %}
++ socket-mem {{ network.vpp.dpdk_socket_mem }}
++{%- endif %}
++ ## Whitelist specific interface by specifying PCI address
++{%- for interface_name, interface in network.interface.items() %}
++{%- if 'dpdk_vpp_port' in interface.type and interface.pci is defined %}
++ dev {{ interface.pci }}
++{%- endif %}
++{%- endfor %}
++}
+diff --git a/linux/network/dpdk.sls b/linux/network/dpdk.sls
+index 786f7c8..09453c6 100644
+--- a/linux/network/dpdk.sls
++++ b/linux/network/dpdk.sls
+@@ -32,6 +32,45 @@ linux_network_dpdk_service:
+ - watch:
+ - file: /etc/dpdk/interfaces
+
++{%- if network.vpp is defined %}
++
++vpp_pkgs:
++ pkg.installed:
++ - pkgs:
++ - vpp
++ - vpp-plugin-core
++ - vpp-plugin-dpdk
++ - bridge-utils
++
++/etc/vpp/commands.txt:
++ file.managed:
++ - source: salt://linux/files/vpp_commands.txt
++ - template: jinja
++ - require:
++ - pkg: vpp_pkgs
++
++/etc/vpp/startup.conf:
++ file.managed:
++ - source: salt://linux/files/vpp_startup.conf
++ - template: jinja
++ - require:
++ - pkg: vpp_pkgs
++
++/etc/sysctl.d/80-vpp.conf:
++ file.managed:
++ - contents:
++ - '# Disabled by salt-formula-linux'
++
++linux_network_vpp_service:
++ service.running:
++ - enable: true
++ - name: vpp
++ - watch:
++ - file: /etc/vpp/startup.conf
++ - file: /etc/vpp/commands.txt
++
++{%- endif %}
++
+ {%- if network.openvswitch is defined %}
+
+ openvswitch_dpdk_pkgs:
diff --git a/mcp/patches/salt-formula-linux/0003-OVS-Fix-Debian-service-deps-OVS-bridge-ifup.patch b/mcp/patches/salt-formula-linux/0003-OVS-Fix-Debian-service-deps-OVS-bridge-ifup.patch
new file mode 100644
index 000000000..70b699a76
--- /dev/null
+++ b/mcp/patches/salt-formula-linux/0003-OVS-Fix-Debian-service-deps-OVS-bridge-ifup.patch
@@ -0,0 +1,97 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2019 Mirantis Inc., Enea AB and others.
+:
+: All rights reserved. This program and the accompanying materials
+: are made available under the terms of the Apache License, Version 2.0
+: which accompanies this distribution, and is available at
+: http://www.apache.org/licenses/LICENSE-2.0
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Fri, 25 Jan 2019 21:20:04 +0100
+Subject: [PATCH] OVS: Fix Debian service deps, OVS bridge ifup
+
+Fix OVS vs Linux bridge race condition:
+- OVS services should start before networking service;
+- OVS services should start after DPDK service (if present);
+- networking service should ifup OVS bridges (and automatically their
+ OVS ports if present) after Linux interfaces/bridges;
+- br-prv should be handled by OVS to avoid another race condition,
+ so use 'allow-ovs br-prv' instead of 'auto';
+
+NOTE:
+- OVS ports/bridges should NOT be configured as auto for this to work;
+- OVS services correspond to OVS 2.9 or newer, since before that
+ ovsdb-server was called openvswitch-nonetwork.
+- we also need to take care of one particularly ugly circular dep:
+ ovs-vswitchd --> ovsdb-server -(default dep)-> sysinit.target -->
+ cloud-init.service --> networking.service --> ovs-vswitchd
+ We'll just set 'DefaultDependencies=no' for ovs services, although
+ this might require explicitly adding back some of the indirect
+ dependencies of sysinit.target.
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ linux/network/dpdk.sls | 2 +-
+ linux/network/interface.sls | 36 ++++++++++++++++++++++++++++++++++++
+ 2 files changed, 37 insertions(+), 1 deletion(-)
+
+diff --git a/linux/network/dpdk.sls b/linux/network/dpdk.sls
+index 09453c6..e866909 100644
+--- a/linux/network/dpdk.sls
++++ b/linux/network/dpdk.sls
+@@ -199,7 +199,7 @@ linux_network_dpdk_bridge_interface_{{ interface_name }}:
+ /etc/network/interfaces.u/ifcfg-{{ interface_name }}:
+ file.managed:
+ - contents: |
+- auto {{ interface_name }}
++ allow-ovs {{ interface_name }}
+ iface {{ interface_name }} inet static
+ address {{ interface.address }}
+ netmask {{ interface.netmask }}
+diff --git a/linux/network/interface.sls b/linux/network/interface.sls
+index 8bce092..11db5be 100644
+--- a/linux/network/interface.sls
++++ b/linux/network/interface.sls
+@@ -24,6 +24,42 @@ linux_network_bridge_pkgs:
+ - pkgs: {{ network.bridge_pkgs }}
+ {%- endif %}
+
++{%- if network.bridge == 'openvswitch' and grains.os_family == 'Debian' %}
++
++{# create drop-in dpdk, networking dependency for ovs services #}
++/etc/systemd/system/ovsdb-server.service.d/override.conf:
++ file.managed:
++ - makedirs: true
++ - require:
++ - pkg: linux_network_bridge_pkgs
++ - contents: |
++ [Unit]
++ After=dpdk.service
++ Before=networking.service
++ DefaultDependencies=no
++
++/etc/systemd/system/ovs-vswitchd.service.d/override.conf:
++ file.managed:
++ - makedirs: true
++ - require:
++ - pkg: linux_network_bridge_pkgs
++ - contents: |
++ [Unit]
++ Before=networking.service
++ DefaultDependencies=no
++
++{# Debian/Ubuntu won't automatically ifup OVS bridges, workaround #}
++/etc/systemd/system/networking.service.d/ovs_workaround.conf:
++ file.managed:
++ - makedirs: true
++ - require:
++ - pkg: linux_network_bridge_pkgs
++ - contents: |
++ [Service]
++ ExecStart=/sbin/ifup --allow=ovs -a --read-environment
++
++{%- endif %}
++
+ {%- endif %}
+
+ {%- for f in network.get('concat_iface_files', []) %}
diff --git a/mcp/patches/salt-formula-linux/0004-dpdk-Handle-per-port-memory-model.patch b/mcp/patches/salt-formula-linux/0004-dpdk-Handle-per-port-memory-model.patch
new file mode 100644
index 000000000..b54650007
--- /dev/null
+++ b/mcp/patches/salt-formula-linux/0004-dpdk-Handle-per-port-memory-model.patch
@@ -0,0 +1,25 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2019 Mirantis Inc., Enea AB and others.
+:
+: All rights reserved. This program and the accompanying materials
+: are made available under the terms of the Apache License, Version 2.0
+: which accompanies this distribution, and is available at
+: http://www.apache.org/licenses/LICENSE-2.0
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+From: Michael Polenchuk <mpolenchuk@mirantis.com>
+Date: Tue, 30 Apr 2019 12:59:54 +0400
+Subject: [PATCH] [dpdk] Handle per port memory model
+
+
+diff --git a/linux/network/dpdk.sls b/linux/network/dpdk.sls
+index 786f7c8..c6f3020 100644
+--- a/linux/network/dpdk.sls
++++ b/linux/network/dpdk.sls
+@@ -49,6 +49,7 @@ linux_network_dpdk_ovs_service:
+ - unless: 'ovs-vsctl get Open_vSwitch . other_config | grep "dpdk-init=\"true\""'
+
+ {%- set ovs_options = [
++ 'per-port-memory="'+network.openvswitch.per_port_memory|d('false')+'"',
+ "pmd-cpu-mask=\""+network.openvswitch.pmd_cpu_mask+"\"",
+ "dpdk-socket-mem=\""+network.openvswitch.dpdk_socket_mem+"\"",
+ "dpdk-lcore-mask=\""+network.openvswitch.dpdk_lcore_mask+"\"",
diff --git a/mcp/patches/salt-formula-linux/0005-network-RHEL-Set-bridge-for-member-interfaces.patch b/mcp/patches/salt-formula-linux/0005-network-RHEL-Set-bridge-for-member-interfaces.patch
new file mode 100644
index 000000000..67004601c
--- /dev/null
+++ b/mcp/patches/salt-formula-linux/0005-network-RHEL-Set-bridge-for-member-interfaces.patch
@@ -0,0 +1,44 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2019 Mirantis Inc., Enea AB and others.
+:
+: All rights reserved. This program and the accompanying materials
+: are made available under the terms of the Apache License, Version 2.0
+: which accompanies this distribution, and is available at
+: http://www.apache.org/licenses/LICENSE-2.0
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Tue, 11 Jun 2019 03:57:29 +0200
+Subject: [PATCH] network: RHEL: Set bridge for member interfaces
+
+For RHEL, bridge member interfaces need to be passed down the
+bridge name, so lookup all bridges, find the one containing the
+current interface (if any) and use it when calling
+`network.managed`.
+
+Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+---
+ linux/network/interface.sls | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/linux/network/interface.sls b/linux/network/interface.sls
+index 11db5be..ccac6d7 100644
+--- a/linux/network/interface.sls
++++ b/linux/network/interface.sls
+@@ -303,6 +303,17 @@ linux_interface_{{ interface_name }}:
+ - cmd: ovs_port_up_{{ network }}
+ {%- endfor %}
+ {%- endif %}
++ {%- if grains.os_family == 'RedHat' %}
++ {%- set br_todo = [] %}
++ {%- for br_name, br_info in network.interface.items() %}
++ {%- if br_info.type == 'bridge' and interface_name in br_info.get('use_interfaces', []) %}
++ {%- do br_todo.append(br_info.get('name', br_name)) %}
++ {%- endif %}
++ {%- endfor %}
++ {%- if br_todo %}
++ - bridge: {{ br_todo | first }}
++ {%- endif %}
++ {%- endif %}
+ {%- if interface.type == 'bridge' %}
+ - bridge: {{ interface_name }}
+ - delay: 0
diff --git a/mcp/patches/salt-formula-linux/0006-dpdk-Remove-invalid-vhost-options.patch b/mcp/patches/salt-formula-linux/0006-dpdk-Remove-invalid-vhost-options.patch
new file mode 100644
index 000000000..acc3c181f
--- /dev/null
+++ b/mcp/patches/salt-formula-linux/0006-dpdk-Remove-invalid-vhost-options.patch
@@ -0,0 +1,25 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+: Copyright (c) 2019 Mirantis Inc., Enea AB and others.
+:
+: All rights reserved. This program and the accompanying materials
+: are made available under the terms of the Apache License, Version 2.0
+: which accompanies this distribution, and is available at
+: http://www.apache.org/licenses/LICENSE-2.0
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+From: Michael Polenchuk <mpolenchuk@mirantis.com>
+Date: Tue, 30 Jul 2019 13:24:41 +0400
+Subject: [PATCH] [dpdk] Remove invalid vhost options
+
+diff --git a/linux/network/dpdk.sls b/linux/network/dpdk.sls
+index 786f7c8..c929e43 100644
+--- a/linux/network/dpdk.sls
++++ b/linux/network/dpdk.sls
+@@ -52,7 +52,7 @@ linux_network_dpdk_ovs_service:
+ "pmd-cpu-mask=\""+network.openvswitch.pmd_cpu_mask+"\"",
+ "dpdk-socket-mem=\""+network.openvswitch.dpdk_socket_mem+"\"",
+ "dpdk-lcore-mask=\""+network.openvswitch.dpdk_lcore_mask+"\"",
+- "dpdk-extra=\"-n "+network.openvswitch.memory_channels+" --vhost-owner libvirt-qemu:kvm --vhost-perm 0664\""
++ "dpdk-extra=\"-n "+network.openvswitch.memory_channels+"\""
+ ]
+ %}
+