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
diff --git a/linux/network/interface.sls b/linux/network/interface.sls
index e225888..311f852 100644
--- a/linux/network/interface.sls
+++ b/linux/network/interface.sls
@@ -183,6 +183,15 @@
{%- 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