瀏覽代碼

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 年之前
父節點
當前提交
8be34715a5
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. +9
    -0
      linux/network/interface.sls

+ 9
- 0
linux/network/interface.sls 查看文件

@@ -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…
取消
儲存