Commit 87e43988 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add check for duplicate MACs in instance add

Currently LUAddInstance doesn't check for duplicate MACs, and it fails
during the Exec() phase when trying to add the instance to the config
(ConfigWriter checks for this). This patch copies the code from
LUModifyInstance (which already does it).

This fixed issue #70.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarOlivier Tharan <>
parent 862b1b2b
......@@ -4592,6 +4592,12 @@ class LUCreateInstance(LogicalUnit):
if not utils.IsValidMac(mac.lower()):
raise errors.OpPrereqError("Invalid MAC address specified: %s" %
# or validate/reserve the current one
if self.cfg.IsMacInUse(mac):
raise errors.OpPrereqError("MAC address %s already in use"
" in cluster" % mac)
# bridge verification
bridge = nic.get("bridge", None)
if bridge is 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