Browse Source

Add a new interface option 'require_interfaces'

Non-destructive patch, won't affect anything because this
option is not used in any model yet.

Official guide for network.managed state provides an example:
bond0:
  network.managed:
    - type: bond
    - slaves: eth2 eth3
    - require:
      - network: eth2
      - network: eth3
    ...
without parameter: '- use:'

* add a new option 'require_interfaces' that allows to set
  '- require:' not only for 'bridge' interfaces
* using 'require_interfaces' allows to fix the order for states
  that create bonds (do not try to create bond0 before slave
  interfaces are configured!)
* using 'require_interfaces' allows to fix the order for states
  that create VLANs (do not try to create tagged interfaces before
  parent interface is created, it locks the parent interface
  creation!), example: bond0.2516 created before bond0
* using 'require_interfaces' allows to fix the order for states
  that depend on OVS interfaces

Change-Id: Id4539a7e24f2c55fb62afe5d47e485effc9a882b
pull/123/head
Dennis Dmitriev 7 years ago
parent
commit
8be34715a5
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      linux/network/interface.sls

+ 9
- 0
linux/network/interface.sls View File

@@ -183,6 +183,15 @@ linux_interface_{{ interface_name }}:
{%- for param in network.interface_params %}
{{ set_param(param, interface) }}
{%- endfor %}
{%- if interface.require_interfaces is defined %}
- require:
{%- for netif in interface.get('require_interfaces', []) %}
- network: linux_interface_{{ netif }}
{%- endfor %}
{%- for network in interface.get('use_ovs_ports', []) %}
- cmd: ovs_port_up_{{ network }}
{%- endfor %}
{%- endif %}
{%- if interface.type == 'bridge' %}
- bridge: {{ interface_name }}
- delay: 0

Loading…
Cancel
Save