Commit 31821208 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix the confusing ssh/hostname message in node add

Before, it used to say:

  ssh/hostname verification failed -> hostname mismatch, got

Now it says for wrong hostnames (maybe too verbose):

  ssh/hostname verification failed (checking from hostname
  mismatch, expected but got node3

And for non-FQDN hostnames:

  ssh/hostname verification failed (checking from hostname
  not FQDN: expected but got node2
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent bae7e531
......@@ -2431,7 +2431,8 @@ class LUAddNode(LogicalUnit):
" for remote verification" % verifier)
if result[verifier].data['nodelist']:
for failed in result[verifier].data['nodelist']:
feedback_fn("ssh/hostname verification failed %s -> %s" %
feedback_fn("ssh/hostname verification failed"
" (checking from %s): %s" %
(verifier, result[verifier].data['nodelist'][failed]))
raise errors.OpExecError("ssh/hostname verification failed.")
......@@ -227,7 +227,12 @@ class SshRunner:
remotehostname = retval.stdout.strip()
if not remotehostname or remotehostname != node:
return False, "hostname mismatch, got %s" % remotehostname
if node.startswith(remotehostname + "."):
msg = "hostname not FQDN"
msg = "hostname mistmatch"
return False, ("%s: expected %s but got %s" %
(msg, node, remotehostname))
return True, "host matches"
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