Commit 7672a621 authored by Iustin Pop's avatar Iustin Pop
Browse files

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: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 58385fad
......@@ -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:
......
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