From 7672a62141cf35c1797449d54280ae10b37f985b Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 3 May 2010 15:32:00 +0200 Subject: [PATCH] Cleanup /etc/hosts during node removal It seems that commit d8470559 dropped the cleanup of /etc/hosts when a node is removed from the cluster. I don't know for sure, but it seems accidental. As long as we add it to /etc/hosts, we should clean it up too. The patch also adds two FIXMEs since this kind of modifications should be done via RPC calls to the master's node daemon, not directly. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- lib/cmdlib.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 42e2166d8..9b9aad758 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -2883,6 +2883,12 @@ class LURemoveNode(LogicalUnit): self.LogWarning("Errors encountered on the remote node while leaving" " the cluster: %s", msg) + # Remove node from our /etc/hosts + if self.cfg.GetClusterInfo().modify_etc_hosts: + # FIXME: this should be done via an rpc call to node daemon + utils.RemoveHostFromEtcHosts(node.name) + _RedistributeAncillaryFiles(self) + class LUQueryNodes(NoHooksLU): """Logical unit for querying nodes. @@ -3457,6 +3463,7 @@ class LUAddNode(LogicalUnit): # Add node to our /etc/hosts, and add key to known_hosts if self.cfg.GetClusterInfo().modify_etc_hosts: + # FIXME: this should be done via an rpc call to node daemon utils.AddHostToEtcHosts(new_node.name) if new_node.secondary_ip != new_node.primary_ip: -- GitLab