Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added persistent cfg for native ovn bond #188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,7 @@ Open vSwitch Bridges:
enabled: true
name: br-ens7
type: ovs_bridge
ovs_ports: ens7
proto: manual
mtu: 9000
use_interfaces:
Expand Down
4 changes: 4 additions & 0 deletions linux/files/ovs_bridge
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ netmask {{ bridge.netmask }}
{%- if bridge.gateway is defined %}
gateway {{ bridge.gateway }}
{%- endif %}
{%- if bridge.ovs_ports is defined %}
ovs_ports {{ bridge.ovs_ports }}
{%- endif %}
{%- if bridge.ovs_options is defined %}
ovs_options {{ bridge.ovs_options }}
{%- endif %}

4 changes: 4 additions & 0 deletions linux/files/ovs_port
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ netmask {{ port.netmask }}
{%- if port.gateway is defined %}
gateway {{ port.gateway }}
{%- endif %}
{%- if port.slaves is defined %}
ovs_bonds {{ port.slaves }}
{%- endif %}
{%- if port.ovs_options is defined %}
ovs_options {{ port.ovs_options }}
{%- endif %}

14 changes: 13 additions & 1 deletion linux/network/interface.sls
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ linux_interfaces_include_{{ interface_name }}:
source /etc/network/interfaces.u/*

ovs_bridge_{{ interface_name }}:
file.managed:
file.append:
- name: /etc/network/interfaces.u/ifcfg-{{ interface_name }}
- makedirs: True
- source: salt://linux/files/ovs_bridge
Expand All @@ -176,6 +176,18 @@ ovs_bond_{{ interface_name }}:
- require:
- ovs_bridge_{{ interface.bridge }}_present

ovs_bond_persistent_{{ interface_name }}:
file.append:
- name: /etc/network/interfaces.u/ifcfg-{{ interface.bridge }}
- makedirs: True
- source: salt://linux/files/ovs_port
- template: jinja
- context:
port_name: {{ interface_name }}
port: {{ interface|yaml }}
- require:
- ovs_bridge_{{ interface.bridge }}

{%- elif interface.type == 'ovs_port' %}

{%- if interface.get('port_type','internal') == 'patch' %}
Expand Down
1 change: 1 addition & 0 deletions tests/pillar/network_openvswitch.sls
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ linux:
enabled: true
type: ovs_bridge
proto: manual
ovs_ports: ens0
mtu: 9000
use_interfaces:
- ens0
Expand Down