Commit 5c0527ed authored by Guido Trotter's avatar Guido Trotter
Browse files

LUAddNode: use node-verify to check node hostname

As we can't use ssh.VerifyNodeHostname directly, we'll set up a mini
node-verify to do checking between the master and the new node. In the
future networking checks, or more nodes, can be added as well.

Reviewed-by: iustinp
parent 3d1e7706
......@@ -1615,12 +1615,22 @@ class LUAddNode(LogicalUnit):
" you gave (%s). Please fix and re-run this"
" command." % new_node.secondary_ip)
success, msg = self.ssh.VerifyNodeHostname(node)
if not success:
raise errors.OpExecError("Node '%s' claims it has a different hostname"
" than the one the resolver gives: %s."
" Please fix and re-run this command." %
(node, msg))
node_verify_list = [self.sstore.GetMasterNode()]
node_verify_param = {
'nodelist': [node],
# TODO: do a node-net-test as well?
}
result = rpc.call_node_verify(node_verify_list, node_verify_param)
for verifier in node_verify_list:
if not result[verifier]:
raise errors.OpExecError("Cannot communicate with %s's node daemon"
" for remote verification" % verifier)
if result[verifier]['nodelist']:
for failed in result[verifier]['nodelist']:
feedback_fn("ssh/hostname verification failed %s -> %s" %
(verifier, result[verifier]['nodelist'][failed]))
raise errors.OpExecError("ssh/hostname verification failed.")
# Distribute updated /etc/hosts and known_hosts to all nodes,
# including the node just added
......
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