Merge pull request #20618 from cxfcxf/develop

add ranged interface support for bond interface
This commit is contained in:
Thomas S Hatch 2015-02-12 10:39:33 -07:00
commit 598f1196a7
2 changed files with 25 additions and 3 deletions

View File

@ -38,6 +38,27 @@ all interfaces are ignored unless specified.
- 8.8.8.8
- 8.8.4.4
eth0-range0:
network.managed:
- type: eth
- ipaddr_start: 192.168.1.1
- ipaddr_end: 192.168.1.10
- clonenum_start: 10
- mtu: 9000
bond0-range0:
network.managed:
- type: eth
- ipaddr_start: 192.168.1.1
- ipaddr_end: 192.168.1.10
- clonenum_start: 10
- mtu: 9000
.. note::
add support for ranged interfaces (bond and eth) for redhat system,
currently not support vlan and type must be eth.
routes:
network.routes:
- name: eth0
@ -292,11 +313,13 @@ def managed(name, type, enabled=True, **kwargs):
ret['comment'] = 'Bond interface {0} ' \
'added.'.format(name)
ret['changes']['bond'] = 'Added bond {0}.'.format(name)
apply_ranged_setting = True
elif old != new:
diff = difflib.unified_diff(old, new, lineterm='')
ret['comment'] = 'Bond interface {0} ' \
'updated.'.format(name)
ret['changes']['bond'] = '\n'.join(diff)
apply_ranged_setting = True
except AttributeError as error:
#TODO Add a way of reversing the interface changes.
ret['result'] = False

View File

@ -1,5 +1,5 @@
{% if "range" not in name %}DEVICE="{{name}}"
{%endif}{% if addr %}HWADDR="{{addr}}"
{%endif%}{% if addr %}HWADDR="{{addr}}"
{%endif%}{% if userctl %}USERCTL="{{userctl}}"
{%endif%}{% if master %}MASTER="{{master}}"
{%endif%}{% if slave %}SLAVE="{{slave}}"
@ -33,4 +33,3 @@
{% endif %}{% for server in dns -%}
DNS{{loop.index}}="{{server}}"
{% endfor -%}