Network OVS: ovs ports must be in an ovs bridge config
If they are not, they won't be brought up on restart.
Change-Id: Ic60c4fd8010cf9e376254c2a98a0eec7b9182305
Related-Prod: PROD-25269
diff --git a/linux/files/ovs_bridge b/linux/files/ovs_bridge
index bf9b74f..40acb04 100644
--- a/linux/files/ovs_bridge
+++ b/linux/files/ovs_bridge
@@ -12,3 +12,6 @@
{%- if bridge.ovs_options is defined %}
ovs_options {{ bridge.ovs_options }}
{%- endif %}
+{%- if bridge_ports %}
+ovs_ports {{ bridge_ports }}
+{%- endif %}
diff --git a/linux/network/interface.sls b/linux/network/interface.sls
index 40d02bb..db6cd9f 100644
--- a/linux/network/interface.sls
+++ b/linux/network/interface.sls
@@ -95,6 +95,8 @@
openvswitch_bridge.present:
- name: {{ interface_name }}
+{%- set ovs_ports = [] %}
+
{# add linux network interface into OVS bridge #}
{%- for int_name, int in network.interface.items() %}
@@ -107,6 +109,11 @@
- unless: ovs-vsctl show | grep {{ int_name }}
- name: ovs-vsctl{%- if network.ovs_nowait %} --no-wait{%- endif %} add-port {{ interface_name }} {{ int_name }}
{%- endif %}
+
+{%- if int.bridge is defined and interface_name == int.bridge %}
+{%- do ovs_ports.append(int_name) %}
+{%- endif %}
+
{%- endfor %}
linux_interfaces_include_{{ interface_name }}:
@@ -125,6 +132,7 @@
- defaults:
bridge: {{ interface|yaml }}
bridge_name: {{ interface_name }}
+ bridge_ports: {{ " ".join(ovs_ports) }}
- template: jinja
ovs_bridge_up_{{ interface_name }}: