Commit 0ce8f948 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add a configuration verify check for duplicate IPs

This patch adds a check that the cluster IP, the nodes primary (and
secondary, if enabled) IP(s) and the instances NIC IPs are unique in the
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent db8667b7
......@@ -396,6 +396,27 @@ class ConfigWriter:
result.append("DRBD minor %d on node %s is assigned twice to instances"
" %s and %s" % (minor, node, instance_a, instance_b))
# IP checks
ips = { data.cluster.master_ip: ["cluster_ip"] }
def _helper(ip, name):
if ip in ips:
ips[ip] = [name]
for node in data.nodes.values():
_helper(node.primary_ip, "node:%s/primary" %
if node.secondary_ip != node.primary_ip:
_helper(node.secondary_ip, "node:%s/secondary" %
for instance in data.instances.values():
for idx, nic in enumerate(instance.nics):
if nic.ip is not None:
_helper(nic.ip, "instance:%s/nic:%d" % (, idx))
for ip, owners in ips.items():
if len(owners) > 1:
result.append("IP address %s is used by multiple owners: %s" %
(ip, ", ".join(owners)))
return result
@locking.ssynchronized(_config_lock, shared=1)
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