[ovs/dpdk] Set bridge datapath_type to netdev
[fuel.git] / mcp / patches / 0015-Set-ovs-bridges-as-L3-interfaces.patch
1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2018 Mirantis Inc., Enea AB and others.
3 :
4 : All rights reserved. This program and the accompanying materials
5 : are made available under the terms of the Apache License, Version 2.0
6 : which accompanies this distribution, and is available at
7 : http://www.apache.org/licenses/LICENSE-2.0
8 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9 From: Michael Polenchuk <mpolenchuk@mirantis.com>
10 Date: Wed, 28 Feb 2018 17:54:28 +0400
11 Subject: [PATCH] Set ovs bridges as L3 interfaces
12
13 Change-Id: I1e83129cc184cf481bea21d7aa452bf60d9e0499
14
15 diff --git a/linux/files/ovs_bridge b/linux/files/ovs_bridge
16 new file mode 100644
17 index 0000000..216581f
18 --- /dev/null
19 +++ b/linux/files/ovs_bridge
20 @@ -0,0 +1,10 @@
21 +auto {{ bridge_name }}
22 +allow-ovs {{ bridge_name }}
23 +iface {{ bridge_name }} inet static
24 +  ovs_type OVSBridge
25 +  address {{ bridge.address }}
26 +  netmask {{ bridge.netmask }}
27 +  mtu {{ bridge.get('mtu', '1500') }}
28 +  {%- if bridge.datapath_type is defined %}
29 +  ovs_extra set Bridge ${IFACE} datapath_type={{ bridge.datapath_type }}
30 +  {%- endif %}
31 diff --git a/linux/files/ovs_port b/linux/files/ovs_port
32 index 222ca8e..efb0307 100644
33 --- a/linux/files/ovs_port
34 +++ b/linux/files/ovs_port
35 @@ -1,6 +1,9 @@
36  auto {{ port_name }}
37  allow-{{ port.bridge }} {{ port_name }}
38  iface {{ port_name }} inet {{ port.get('proto', 'manual') }}
39 +{%- if '.' in port_name %}
40 +vlan-raw-device {{ port_name.split('.')[0] }}
41 +{%- endif %}
42  ovs_type {{ port.get('ovs_port_type', 'OVSIntPort') }}
43  mtu {{ port.get('mtu', '1500') }}
44  ovs_bridge {{ port.bridge }}
45 diff --git a/linux/network/interface.sls b/linux/network/interface.sls
46 index fa37e5e..b5ed1ae 100644
47 --- a/linux/network/interface.sls
48 +++ b/linux/network/interface.sls
49 @@ -91,6 +91,34 @@ add_int_{{ int_name }}_to_ovs_dpdk_bridge_{{ interface_name }}:
50  ovs_bridge_{{ interface_name }}:
51    openvswitch_bridge.present:
52    - name: {{ interface_name }}
53 +{%- if interface.get('proto', 'manual') == 'static' %}
54 +  file.managed:
55 +  - name: /etc/network/interfaces.u/ifcfg-{{ interface_name }}
56 +  - makedirs: True
57 +  - source: salt://linux/files/ovs_bridge
58 +  - defaults:
59 +      bridge: {{ interface|yaml }}
60 +      bridge_name: {{ interface_name }}
61 +  - template: jinja
62 +
63 +linux_interfaces_include_{{ interface_name }}:
64 +  file.prepend:
65 +  - name: /etc/network/interfaces
66 +  - text: |
67 +      source /etc/network/interfaces.d/*
68 +      # Workaround for Upstream-Bug: https://github.com/saltstack/salt/issues/40262
69 +      source /etc/network/interfaces.u/*
70 +
71 +ovs_bridge_up_{{ interface_name }}:
72 +  cmd.run:
73 +  - name: ifup {{ interface_name }}
74 +  - require:
75 +    - file: ovs_bridge_{{ interface_name }}
76 +    - openvswitch_bridge: ovs_bridge_{{ interface_name }}
77 +    - file: linux_interfaces_final_include
78 +  - unless:
79 +    - ip link show {{ interface_name }} | grep -q '\<UP\>'
80 +{%- endif %}
81
82  {# add linux network interface into OVS bridge #}
83  {%- for int_name, int in network.interface.items() %}