Commit 1513e2dd authored by Iustin Pop's avatar Iustin Pop
Browse files

Readd node: allow changed primary IP



The primary IP is not used for DRBD disks, only for the job queue and
internal commands. As such, it's trivial (with a quiet job queue) to
re-ip the node.

The patch just relaxes the checks in LUAddNode, and manual testing shows
that live instances on that node keep working, and that cluster verify
is happy afterwards.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 89100352
......@@ -3318,15 +3318,19 @@ class LUAddNode(LogicalUnit):
raise errors.OpPrereqError("Node %s is not in the configuration" % node,
errors.ECODE_NOENT)
self.changed_primary_ip = False
for existing_node_name in node_list:
existing_node = cfg.GetNodeInfo(existing_node_name)
if self.op.readd and node == existing_node_name:
if (existing_node.primary_ip != primary_ip or
existing_node.secondary_ip != secondary_ip):
if existing_node.secondary_ip != secondary_ip:
raise errors.OpPrereqError("Readded node doesn't have the same IP"
" address configuration as before",
errors.ECODE_INVAL)
if existing_node.primary_ip != primary_ip:
self.changed_primary_ip = True
continue
if (existing_node.primary_ip == primary_ip or
......@@ -3398,6 +3402,8 @@ class LUAddNode(LogicalUnit):
self.LogInfo("Readding a node, the offline/drained flags were reset")
# if we demote the node, we do cleanup later in the procedure
new_node.master_candidate = self.master_candidate
if self.changed_primary_ip:
new_node.primary_ip = self.op.primary_ip
# notify the user about any possible mc promotion
if new_node.master_candidate:
......
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