[doc] installation guide update: PDF section
[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..575d38f
18 --- /dev/null
19 +++ b/linux/files/ovs_bridge
20 @@ -0,0 +1,12 @@
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 +  {%- if bridge.gateway is defined %}
28 +  gateway {{ bridge.gateway }}
29 +  {%- endif %}
30 +  {%- if bridge.ovs_options is defined %}
31 +  ovs_options {{ bridge.ovs_options }}
32 +  {%- endif %}
33 diff --git a/linux/files/ovs_port b/linux/files/ovs_port
34 index 222ca8e..efb0307 100644
35 --- a/linux/files/ovs_port
36 +++ b/linux/files/ovs_port
37 @@ -1,6 +1,9 @@
38  auto {{ port_name }}
39  allow-{{ port.bridge }} {{ port_name }}
40  iface {{ port_name }} inet {{ port.get('proto', 'manual') }}
41 +{%- if '.' in port_name %}
42 +vlan-raw-device {{ port_name.split('.')[0] }}
43 +{%- endif %}
44  ovs_type {{ port.get('ovs_port_type', 'OVSIntPort') }}
45  mtu {{ port.get('mtu', '1500') }}
46  ovs_bridge {{ port.bridge }}
47 diff --git a/linux/network/interface.sls b/linux/network/interface.sls
48 index 3e79847..dc7180a 100644
49 --- a/linux/network/interface.sls
50 +++ b/linux/network/interface.sls
51 @@ -72,6 +72,34 @@ remove_cloud_init_file:
52  ovs_bridge_{{ interface_name }}:
53    openvswitch_bridge.present:
54    - name: {{ interface_name }}
55 +{%- if interface.get('proto', 'manual') == 'static' %}
56 +  file.managed:
57 +  - name: /etc/network/interfaces.u/ifcfg-{{ interface_name }}
58 +  - makedirs: True
59 +  - source: salt://linux/files/ovs_bridge
60 +  - defaults:
61 +      bridge: {{ interface|yaml }}
62 +      bridge_name: {{ interface_name }}
63 +  - template: jinja
64 +
65 +linux_interfaces_include_{{ interface_name }}:
66 +  file.prepend:
67 +  - name: /etc/network/interfaces
68 +  - text: |
69 +      source /etc/network/interfaces.d/*
70 +      # Workaround for Upstream-Bug: https://github.com/saltstack/salt/issues/40262
71 +      source /etc/network/interfaces.u/*
72 +
73 +ovs_bridge_up_{{ interface_name }}:
74 +  cmd.run:
75 +  - name: ifup {{ interface_name }}
76 +  - require:
77 +    - file: ovs_bridge_{{ interface_name }}
78 +    - openvswitch_bridge: ovs_bridge_{{ interface_name }}
79 +    - file: linux_interfaces_final_include
80 +  - unless:
81 +    - ip link show {{ interface_name }} | grep -q '\<UP\>'
82 +{%- endif %}
83
84  {# add linux network interface into OVS bridge #}
85  {%- for int_name, int in network.interface.items() %}