mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Merge pull request #29530 from mparisot-wescale/develop
Fixes on bonding and vlans for RH7
This commit is contained in:
commit
263135b61c
@ -206,7 +206,7 @@ def _parse_settings_bond(opts, iface):
|
||||
# Used with miimon.
|
||||
# On: driver sends mii
|
||||
# Off: ethtool sends mii
|
||||
'use_carrier': 'on',
|
||||
'use_carrier': '0',
|
||||
# Default. Don't change unless you know what you are doing.
|
||||
'xmit_hash_policy': 'layer2',
|
||||
}
|
||||
@ -547,6 +547,34 @@ def _parse_settings_bond_6(opts, iface, bond_def):
|
||||
return bond
|
||||
|
||||
|
||||
def _parse_settings_vlan(opts, iface):
|
||||
|
||||
'''
|
||||
Filters given options and outputs valid settings for a vlan
|
||||
'''
|
||||
vlan = {}
|
||||
if 'reorder_hdr' in opts:
|
||||
if opts['reorder_hdr'] in _CONFIG_TRUE + _CONFIG_FALSE:
|
||||
vlan.update({'reorder_hdr': opts['reorder_hdr']})
|
||||
else:
|
||||
valid = _CONFIG_TRUE + _CONFIG_FALSE
|
||||
_raise_error_iface(iface, 'reorder_hdr', valid)
|
||||
|
||||
if 'vlan_id' in opts:
|
||||
if opts['vlan_id'] > 0:
|
||||
vlan.update({'vlan_id': opts['vlan_id']})
|
||||
else:
|
||||
_raise_error_iface(iface, 'vlan_id', 'Positive integer')
|
||||
|
||||
if 'phys_dev' in opts:
|
||||
if len(opts['phys_dev']) > 0:
|
||||
vlan.update({'phys_dev': opts['phys_dev']})
|
||||
else:
|
||||
_raise_error_iface(iface, 'phys_dev', 'Non-empty string')
|
||||
|
||||
return vlan
|
||||
|
||||
|
||||
def _parse_settings_eth(opts, iface_type, enabled, iface):
|
||||
'''
|
||||
Filters given options and outputs valid settings for a
|
||||
@ -582,6 +610,14 @@ def _parse_settings_eth(opts, iface_type, enabled, iface):
|
||||
bonding = _parse_settings_bond(opts, iface)
|
||||
if bonding:
|
||||
result['bonding'] = bonding
|
||||
result['devtype'] = "Bond"
|
||||
|
||||
if iface_type == 'vlan':
|
||||
vlan = _parse_settings_vlan(opts, iface)
|
||||
if vlan:
|
||||
result['devtype'] = "Vlan"
|
||||
for opt in vlan:
|
||||
result[opt] = opts[opt]
|
||||
|
||||
if iface_type not in ['bond', 'vlan', 'bridge', 'ipip']:
|
||||
if 'addr' in opts:
|
||||
|
@ -6,7 +6,10 @@ DEVICE="{{name}}"
|
||||
{%endif%}{% if master %}MASTER="{{master}}"
|
||||
{%endif%}{% if slave %}SLAVE="{{slave}}"
|
||||
{%endif%}{% if vlan %}VLAN="{{vlan}}"
|
||||
{%endif%}{% if devtype %}TYPE="{{devtype}}"
|
||||
{% if reorder_hdr %}REORDER_HDR="{{reorder_hdr}}"
|
||||
{%endif%}{% if vlan_id %}VID="{{vlan_id}}"
|
||||
{%endif%}{% if phys_dev %}PHYSDEV="{{phys_dev}}"
|
||||
{%endif%}{%endif%}{% if devtype %}TYPE="{{devtype}}"
|
||||
{%endif%}{% if proto %}BOOTPROTO="{{proto}}"
|
||||
{%endif%}{% if onboot %}ONBOOT="{{onboot}}"
|
||||
{%endif%}{% if onparent %}ONPARENT={{onparent}}
|
||||
|
Loading…
Reference in New Issue
Block a user