Pārlūkot izejas kodu

OVS improvements

tags/mcp0.5
Jakub Pavlik pirms 8 gadiem
vecāks
revīzija
fc60eb0668
3 mainītis faili ar 41 papildinājumiem un 4 dzēšanām
  1. +3
    -0
      linux/files/ovs_port
  2. +4
    -0
      linux/map.jinja
  3. +34
    -4
      linux/network/interface.sls

+ 3
- 0
linux/files/ovs_port Parādīt failu

@@ -8,6 +8,9 @@ ovs_bridge {{ port.bridge }}
address {{ port.address }}
netmask {{ port.netmask }}
{%- endif %}
{%- if port.gateway is defined %}
gateway {{ port.gateway }}
{%- endif %}
{%- if port.ovs_options is defined %}
ovs_options {{ port.ovs_options }}
{%- endif %}

+ 4
- 0
linux/map.jinja Parādīt failu

@@ -55,7 +55,11 @@
'broadcast',
'master',
'miimon',
'ovs_ports',
'ovs_bridge',
'mode',
'port_type',
'peer',
'lacp-rate',
'dns-search',
'up_cmds',

+ 34
- 4
linux/network/interface.sls Parādīt failu

@@ -34,18 +34,46 @@ ovs_bridge_{{ interface_name }}:
openvswitch_bridge.present:
- name: {{ interface_name }}

{# add linux network interface into OVS bridge #}
{%- for int_name, int in network.interface.iteritems() %}

{%- set int_name = int.get('name', int_name) %}

{%- if int.ovs_bridge is defined %}

add_int_to_ovs_bridge_{{ interface_name }}:
cmd.run:
- unless: ovs-vsctl show | grep {{ int_name }}
- name: ovs-vsctl add-port {{ interface_name }} {{ int_name }}

{%- endif %}

{%- endfor %}

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

{#
{%- if interface.get('port_type','internal') == 'patch' %}

ovs_port_{{ interface_name }}:
openvswitch_port.present:
- name: {{ interface_name }}
- bridge: {{ interface.bridge }}
- require:
- openvswitch_bridge: ovs_bridge_{{ interface.bridge }}
#}

linux_interfaces_include:
ovs_port_set_type_{{ interface_name }}:
cmd.run:
- name: ovs-vsctl set interface {{ interface_name }} type=patch
- unless: ovs-vsctl show | grep -A 1 'Interface {{ interface_name }}' | grep patch

ovs_port_set_peer_{{ interface_name }}:
cmd.run:
- name: ovs-vsctl set interface {{ interface_name }} options:peer={{ interface.peer }}
- unless: ovs-vsctl show | grep -A 2 'Interface floating-to-prv' | grep {{ interface.peer }}

{%- else %}

linux_interfaces_include_{{ interface_name }}:
file.prepend:
- name: /etc/network/interfaces
- text: 'source /etc/network/interfaces.d/*'
@@ -68,7 +96,7 @@ ovs_port_{{ interface_name }}_line1:
ovs_port_{{ interface_name }}_line2:
file.replace:
- name: /etc/network/interfaces
- pattern: iface {{ interface_name }} inet manual
- pattern: 'iface {{ interface_name }} inet .*'
- repl: ""

ovs_port_up_{{ interface_name }}:
@@ -80,6 +108,8 @@ ovs_port_up_{{ interface_name }}:
- file: ovs_port_{{ interface_name }}_line2
- openvswitch_bridge: ovs_bridge_{{ interface.bridge }}

{%- endif %}

{%- else %}

linux_interface_{{ interface_name }}:

Notiek ielāde…
Atcelt
Saglabāt