Merge pull request #21346 from sinnerschrader/fix/2014_7_fix_ubuntu_network_bonding

* fixes states.network bonding for debian
This commit is contained in:
Thomas S Hatch 2015-03-06 08:56:16 -07:00
commit be4405f43d
3 changed files with 9 additions and 5 deletions

View File

@ -1176,12 +1176,14 @@ def _parse_settings_eth(opts, iface_type, enabled, iface):
if iface_type == 'bridge':
bridging = _parse_bridge_opts(opts, iface)
if bridging:
opts.pop('mode', None)
iface_data['inet']['bridging'] = bridging
iface_data['inet']['bridging_keys'] = sorted(bridging)
elif iface_type == 'bond':
bonding = _parse_settings_bond(opts, iface)
if bonding:
opts.pop('mode', None)
iface_data['inet']['bonding'] = bonding
iface_data['inet']['bonding']['slaves'] = opts['slaves']
iface_data['inet']['bonding_keys'] = sorted(bonding)
@ -1397,9 +1399,9 @@ def _write_file_ifaces(iface, data):
for adapter in adapters:
if 'type' in adapters[adapter] and adapters[adapter]['type'] == 'slave':
# Override values so the interfaces file is correct
adapters[adapter]['enabled'] = False
adapters[adapter]['data']['inet']['addrfam'] = 'inet'
adapters[adapter]['data']['inet']['proto'] = 'manual'
adapters[adapter]['data']['inet']['master'] = adapters[adapter]['master']
tmp = template.render({'name': adapter, 'data': adapters[adapter]})
ifcfg = tmp + ifcfg

View File

@ -53,11 +53,13 @@ all interfaces are ignored unless specified.
eth2:
network.managed:
- enabled: True
- type: slave
- master: bond0
eth3:
network.managed:
- enabled: True
- type: slave
- master: bond0
@ -73,18 +75,17 @@ all interfaces are ignored unless specified.
- type: bond
- ipaddr: 10.1.0.1
- netmask: 255.255.255.0
- mode: active-backup
- proto: static
- dns:
- 8.8.8.8
- 8.8.4.4
- ipv6:
- enabled: False
- use_in:
- network: eth2
- network: eth3
- slaves: eth2 eth3
- require:
- network: eth2
- network: eth3
- mode: 802.3ad
- miimon: 100
- arp_interval: 250
- downdelay: 200

View File

@ -30,6 +30,7 @@
{%endif%}{% if interface.provider %} provider {{interface.provider}}
{%endif%}{% if interface.unit %} unit {{interface.unit}}
{%endif%}{% if interface.options %} options {{interface.options}}
{%endif%}{% if interface.master %} bond_master {{interface.master}}
{%endif%}{% if interface.dns_nameservers %} dns-nameservers {%for item in interface.dns_nameservers %}{{item}} {%endfor%}
{%endif%}{% if interface.dns_search %} dns-search {% for item in interface.dns_search %}{{item}} {%endfor%}
{%endif%}{% if interface.ethtool %}{%for item in interface.ethtool_keys %} {{item}} {{interface.ethtool[item]}}