Allow BondEthernet to set MAC, and disallow interfaces to set their MAC if they are a bond member
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
#
|
||||
import logging
|
||||
import config.interface as interface
|
||||
import config.mac as mac
|
||||
|
||||
def get_bondethernets(yaml):
|
||||
""" Return a list of all bondethernets. """
|
||||
@ -170,6 +171,9 @@ def validate_bondethernets(yaml):
|
||||
if not get_mode(yaml, bond_ifname) in ['xor','lacp'] and 'load-balance' in iface:
|
||||
msgs.append("bondethernet %s can only have load-balance if in mode XOR or LACP" % (ifname))
|
||||
result = False
|
||||
if 'mac' in iface and mac.is_multicast(iface['mac']):
|
||||
msgs.append("bondethernet %s MAC address %s cannot be multicast" % (ifname, iface['mac']))
|
||||
result = False
|
||||
|
||||
if not 'interfaces' in iface:
|
||||
continue
|
||||
|
@ -422,6 +422,9 @@ def validate_interfaces(yaml):
|
||||
if ifname.startswith("BondEthernet") and (None,None) == bondethernet.get_by_name(yaml, ifname):
|
||||
msgs.append("interface %s does not exist in bondethernets" % ifname)
|
||||
result = False
|
||||
if ifname.startswith("BondEthernet") and 'mac' in iface:
|
||||
msgs.append("interface %s is a member of bondethernet, cannot set MAC" % ifname)
|
||||
result = False
|
||||
if not 'state' in iface:
|
||||
iface['state'] = 'up'
|
||||
|
||||
|
Reference in New Issue
Block a user