library: reject setting 'zone' for slave types

This commit is contained in:
Thomas Haller 2018-01-17 13:18:26 +01:00
parent 1df778917e
commit 0ca86c9dbd

View file

@ -880,6 +880,12 @@ class ArgValidator_DictConnection(ArgValidatorDict):
if 'master' not in result:
result['ip'] = self.nested['ip'].get_default_value()
if 'zone' in result:
if 'master' in result:
raise ValidationError(name + '.zone', '"zone" cannot be configured for slave types')
else:
result['zone'] = None
if 'mac' in result:
if result['type'] not in [ 'ethernet', 'infiniband' ]:
raise ValidationError(name + '.mac', 'a "mac" address is only allowed for type "ethernet" or "infiniband"')