Browse Source

Add slave interfaces to bond master after bond was created/set up

This workaround is required until salt with the patch [1] is not
used.

- use 'ifenslave' tool to enslave necessary interfaces only if bond
  interface has been changed
- install package that provides 'ifenslave' tool

[1] https://github.com/saltstack/salt/pull/39912

Change-Id: I65b607f26cf7319efb60f154951855d1334e1640
pull/123/head
Dennis Dmitriev 7 years ago
parent
commit
73020e52eb
2 changed files with 20 additions and 1 deletions
  1. +3
    -1
      linux/map.jinja
  2. +17
    -0
      linux/network/interface.sls

+ 3
- 1
linux/map.jinja View File

@@ -117,7 +117,7 @@

{% set network = salt['grains.filter_by']({
'Arch': {
'pkgs': ['wpa_supplicant', 'dhclient', 'wireless_tools'],
'pkgs': ['wpa_supplicant', 'dhclient', 'wireless_tools', 'ifenslave'],
'bridge_pkgs': ['bridge-utils'],
'ovs_pkgs': ['openvswitch-switch'],
'hostname_file': '/etc/hostname',
@@ -134,6 +134,7 @@
'dhclient_config': '/etc/dhcp/dhclient.conf',
},
'Debian': {
'pkgs': ['ifenslave'],
'hostname_file': '/etc/hostname',
'bridge_pkgs': ['bridge-utils'],
'ovs_pkgs': ['openvswitch-switch', 'bridge-utils'],
@@ -151,6 +152,7 @@
'dhclient_config': '/etc/dhcp/dhclient.conf',
},
'RedHat': {
'pkgs': ['iputils'],
'bridge_pkgs': ['bridge-utils'],
'ovs_pkgs': ['openvswitch-switch', 'bridge-utils'],
'hostname_file': '/etc/sysconfig/network',

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

@@ -224,6 +224,23 @@ linux_interface_ipflush_onchange_{{ interface_name }}:

{%- endif %}

{%- if salt['grains.get']('saltversion') < '2017.7' %}
# TODO(ddmitriev): Remove this 'if .. endif' block completely when
# switched to salt version 2017.7 that has the same functionality.
{%- if interface.type == 'bond' and interface.enabled == True %}
linux_bond_interface_{{ interface_name }}:
cmd.run:
- name: ifenslave {{ interface_name }} {{ interface.slaves }}
- require:
- network: linux_interface_{{ interface_name }}
- onchanges:
- network: linux_interface_{{ interface_name }}
{%- for network in interface.slaves.split() %}
- network: linux_interface_{{ network }}
{%- endfor %}
{%- endif %}
{%- endif %}

{%- for network in interface.get('use_ovs_ports', []) %}

remove_interface_{{ network }}_line1:

Loading…
Cancel
Save