From 1513e2dd38991a7d0d58853e2628fdded512e81e Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Fri, 16 Apr 2010 15:36:49 +0200 Subject: [PATCH] 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: Iustin Pop Reviewed-by: Michael Hanselmann --- lib/cmdlib.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 054d884..0b05592 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -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: -- 1.7.10.4