be8ba1ee4e22d1169c82fdb7675fd977543c8d69
[fuel.git] / mcp / patches / 0001-Filter-out-OpenDaylight-client-on-computes.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: Mon, 12 Mar 2018 16:32:50 +0400
11 Subject: [PATCH] Filter out OpenDaylight client on computes
12
13 OpenDaylight uses pseudo agents to manage network ports,
14 therefore detach unwanted ovs agent & etc. from compute state.
15 Also swap the set-manager target with tunnel_ip/provider_mappings
16 settings since ovs host config should be in place before manager setup.
17
18 Change-Id: I07cd760fdb4ce84aba21450af9246c8c9128118f
19
20 diff --git a/neutron/compute.sls b/neutron/compute.sls
21 index 418282d..e83a5b7 100644
22 --- a/neutron/compute.sls
23 +++ b/neutron/compute.sls
24 @@ -2,6 +2,36 @@
25  {%- if compute.enabled %}
26
27  {% if compute.backend.engine == "ml2" %}
28 +
29 +{% if compute.get('dhcp_agent_enabled', False) %}
30 +neutron_dhcp_agent_packages:
31 +  pkg.installed:
32 +  - names:
33 +    - neutron-dhcp-agent
34 +
35 +neutron_dhcp_agent:
36 +  service.running:
37 +    - enable: true
38 +    - names:
39 +      - neutron-dhcp-agent
40 +    - watch:
41 +      - file: /etc/neutron/dhcp_agent.ini
42 +    - require:
43 +      - pkg: neutron_dhcp_agent_packages
44 +
45 +/etc/neutron/dhcp_agent.ini:
46 +  file.managed:
47 +  - source: salt://neutron/files/{{ compute.version }}/dhcp_agent.ini
48 +  - template: jinja
49 +  - require:
50 +    - pkg: neutron_dhcp_agent_packages
51 +
52 +{% endif %}
53 +
54 +{%- if compute.opendaylight is defined %}
55 +include:
56 +  - .opendaylight.client
57 +{%- else %}
58  neutron_compute_packages:
59    pkg.installed:
60    - names: {{ compute.pkgs }}
61 @@ -53,31 +83,6 @@ neutron_sriov_service:
62
63  {% endif %}
64
65 -{% if compute.get('dhcp_agent_enabled', False) %}
66 -neutron_dhcp_agent_packages:
67 -  pkg.installed:
68 -  - names:
69 -    - neutron-dhcp-agent
70 -
71 -neutron_dhcp_agent:
72 -  service.running:
73 -    - enable: true
74 -    - names:
75 -      - neutron-dhcp-agent
76 -    - watch:
77 -      - file: /etc/neutron/dhcp_agent.ini
78 -    - require:
79 -      - pkg: neutron_dhcp_agent_packages
80 -
81 -/etc/neutron/dhcp_agent.ini:
82 -  file.managed:
83 -  - source: salt://neutron/files/{{ compute.version }}/dhcp_agent.ini
84 -  - template: jinja
85 -  - require:
86 -    - pkg: neutron_dhcp_agent_packages
87 -
88 -{% endif %}
89 -
90  {% if compute.dvr %}
91
92  {%- if fwaas.get('enabled', False) %}
93 @@ -243,10 +248,7 @@ rabbitmq_ca_neutron_compute:
94  {%- endif %}
95  {%- endif %}
96
97 -{%- if compute.opendaylight is defined %}
98 -include:
99 -  - .opendaylight.client
100 -{%- endif %}
101 +{%- endif %}{# !OpenDaylight #}
102
103  {%- elif compute.backend.engine == "ovn" %}
104
105 diff --git a/neutron/opendaylight/client.sls b/neutron/opendaylight/client.sls
106 index 57e6bcc..79ab0a2 100644
107 --- a/neutron/opendaylight/client.sls
108 +++ b/neutron/opendaylight/client.sls
109 @@ -9,27 +9,27 @@ python-networking-odl:
110
111  {%- if not grains.get('noservices', False) %}
112
113 -ovs_set_manager:
114 +neutron_odl_ovs_hostconfig:
115    cmd.run:
116 -  - name: 'ovs-vsctl set-manager {{ neutron.opendaylight.ovsdb_server_iface }} {{ neutron.opendaylight.ovsdb_odl_iface }}'
117 -  - unless: 'ovs-vsctl get-manager | fgrep -x {{ neutron.opendaylight.ovsdb_odl_iface }}'
118 +  - name: 'neutron-odl-ovs-hostconfig --noovs_dpdk'
119 +  - require:
120 +    - pkg: python-networking-odl
121
122  ovs_set_tunnel_endpoint:
123    cmd.run:
124    - name: 'ovs-vsctl set Open_vSwitch . other_config:local_ip={{ neutron.opendaylight.tunnel_ip }}'
125 -  - unless: 'ovs-vsctl get Open_vSwitch . other_config | fgrep local_ip="{{ neutron.opendaylight.tunnel_ip }}"'
126 +  - unless: 'ovs-vsctl get Open_vSwitch . other_config | fgrep -q local_ip=\"{{ neutron.opendaylight.tunnel_ip }}\"'
127
128  {%- if neutron.opendaylight.provider_mappings is defined %}
129  ovs_set_provider_mappings:
130    cmd.run:
131    - name: 'ovs-vsctl set Open_vSwitch . other_config:provider_mappings={{ neutron.opendaylight.provider_mappings }}'
132 -  - unless: 'ovs-vsctl get Open_vSwitch . other_config | fgrep provider_mappings="{{ neutron.opendaylight.provider_mappings }}"'
133 +  - unless: 'ovs-vsctl get Open_vSwitch . other_config | fgrep -q provider_mappings=\"{{ neutron.opendaylight.provider_mappings }}\"'
134  {%- endif %}
135
136 -neutron_odl_ovs_hostconfig:
137 +ovs_set_manager:
138    cmd.run:
139 -  - name: 'neutron-odl-ovs-hostconfig --noovs_dpdk'
140 -  - require:
141 -    - pkg: python-networking-odl
142 +  - name: 'ovs-vsctl set-manager {{ neutron.opendaylight.ovsdb_server_iface }} {{ neutron.opendaylight.ovsdb_odl_iface }}'
143 +  - unless: 'ovs-vsctl get-manager | fgrep -qx {{ neutron.opendaylight.ovsdb_odl_iface }}'
144
145  {%- endif %}