1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2019 Mirantis Inc., Enea AB and others.
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: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
10 Date: Fri, 25 Jan 2019 21:20:04 +0100
11 Subject: [PATCH] OVS: Fix Debian service deps, OVS bridge ifup
13 Fix OVS vs Linux bridge race condition:
14 - OVS services should start before networking service;
15 - OVS services should start after DPDK service (if present);
16 - networking service should ifup OVS bridges (and automatically their
17 OVS ports if present) after Linux interfaces/bridges;
18 - br-prv should be handled by OVS to avoid another race condition,
19 so use 'allow-ovs br-prv' instead of 'auto';
22 - OVS ports/bridges should NOT be configured as auto for this to work;
23 - OVS services correspond to OVS 2.9 or newer, since before that
24 ovsdb-server was called openvswitch-nonetwork.
25 - we also need to take care of one particularly ugly circular dep:
26 ovs-vswitchd --> ovsdb-server -(default dep)-> sysinit.target -->
27 cloud-init.service --> networking.service --> ovs-vswitchd
28 We'll just set 'DefaultDependencies=no' for ovs services, although
29 this might require explicitly adding back some of the indirect
30 dependencies of sysinit.target.
32 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
34 linux/network/dpdk.sls | 2 +-
35 linux/network/interface.sls | 36 ++++++++++++++++++++++++++++++++++++
36 2 files changed, 37 insertions(+), 1 deletion(-)
38 diff --git a/linux/network/dpdk.sls b/linux/network/dpdk.sls
39 index 09453c6..e866909 100644
40 --- a/linux/network/dpdk.sls
41 +++ b/linux/network/dpdk.sls
42 @@ -199,7 +199,7 @@ linux_network_dpdk_bridge_interface_{{ interface_name }}:
43 /etc/network/interfaces.u/ifcfg-{{ interface_name }}:
46 - auto {{ interface_name }}
47 + allow-ovs {{ interface_name }}
48 iface {{ interface_name }} inet static
49 address {{ interface.address }}
50 netmask {{ interface.netmask }}
51 diff --git a/linux/network/interface.sls b/linux/network/interface.sls
52 index 8bce092..11db5be 100644
53 --- a/linux/network/interface.sls
54 +++ b/linux/network/interface.sls
55 @@ -24,6 +24,42 @@ linux_network_bridge_pkgs:
56 - pkgs: {{ network.bridge_pkgs }}
59 +{%- if network.bridge == 'openvswitch' and grains.os_family == 'Debian' %}
61 +{# create drop-in dpdk, networking dependency for ovs services #}
62 +/etc/systemd/system/ovsdb-server.service.d/override.conf:
66 + - pkg: linux_network_bridge_pkgs
70 + Before=networking.service
71 + DefaultDependencies=no
73 +/etc/systemd/system/ovs-vswitchd.service.d/override.conf:
77 + - pkg: linux_network_bridge_pkgs
80 + Before=networking.service
81 + DefaultDependencies=no
83 +{# Debian/Ubuntu won't automatically ifup OVS bridges, workaround #}
84 +/etc/systemd/system/networking.service.d/ovs_workaround.conf:
88 + - pkg: linux_network_bridge_pkgs
91 + ExecStart=/sbin/ifup --allow=ovs -a --read-environment
97 {%- for f in network.get('concat_iface_files', []) %}