Commit ca519248 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Michael Hanselmann
Browse files

Use new util function for mac_prefix validation

Use new NormalizeAndValidateThreeOctetMacPrefix() util function in
LUNetworkAdd/LUNetworkSetParams to validate network's MAC prefix.
Additionally, move the check in CheckArguments() in the case of
Signed-off-by: default avatarDimitris Aragiorgis <>
Reviewed-by: default avatarMichael Hanselmann <>
parent 26e88cde
......@@ -15662,6 +15662,11 @@ class LUNetworkAdd(LogicalUnit):
mn = self.cfg.GetMasterNode()
return ([mn], [mn])
def CheckArguments(self):
if self.op.mac_prefix:
self.op.mac_prefix = \
def ExpandNames(self):
self.network_uuid = self.cfg.GenerateUniqueID(self.proc.GetECId())
......@@ -15676,12 +15681,6 @@ class LUNetworkAdd(LogicalUnit):
self.add_locks[locking.LEVEL_NETWORK] = self.network_uuid
def CheckPrereq(self):
"""Check prerequisites.
This checks that the given group name is not an existing node group
if is None:
raise errors.OpPrereqError("Network must be given",
......@@ -15692,9 +15691,6 @@ class LUNetworkAdd(LogicalUnit):
raise errors.OpPrereqError("Network '%s' already defined" %, errors.ECODE_EXISTS)
if self.op.mac_prefix:
utils.NormalizeAndValidateMac(self.op.mac_prefix + ":00:00:00")
# Check tag validity
for tag in self.op.tags:
......@@ -15896,8 +15892,8 @@ class LUNetworkSetParams(LogicalUnit):
if self.op.mac_prefix == constants.VALUE_NONE:
self.mac_prefix = None
utils.NormalizeAndValidateMac(self.op.mac_prefix + ":00:00:00")
self.mac_prefix = self.op.mac_prefix
self.mac_prefix = \
if self.op.gateway6:
if self.op.gateway6 == constants.VALUE_NONE:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment