Revision 87622829

b/lib/bootstrap.py
271 271
    logging.warning("Could not shutdown the node daemon and cleanup the node")
272 272

  
273 273

  
274
def SetupNodeDaemon(node, ssh_key_check):
274
def SetupNodeDaemon(cluster_name, node, ssh_key_check):
275 275
  """Add a node to the cluster.
276 276

  
277 277
  This function must be called before the actual opcode, and will ssh
278 278
  to the remote node, copy the needed files, and start ganeti-noded,
279 279
  allowing the master to do the rest via normal rpc calls.
280 280

  
281
  Args:
282
    node: fully qualified domain name for the new node
281
  @param cluster_name: the cluster name
282
  @param node: the name of the new node
283
  @param ssh_key_check: whether to do a strict key check
283 284

  
284 285
  """
285
  cfg = ssconf.SimpleConfigReader()
286
  sshrunner = ssh.SshRunner(cfg.GetClusterName())
286
  sshrunner = ssh.SshRunner(cluster_name)
287 287
  gntpem = utils.ReadFile(constants.SSL_CERT_FILE)
288 288
  # in the base64 pem encoding, neither '!' nor '.' are valid chars,
289 289
  # so we use this to detect an invalid certificate; as long as the
......
313 313
                             " output: %s" %
314 314
                             (node, result.fail_reason, result.output))
315 315

  
316
  return 0
317

  
318 316

  
319 317
def MasterFailover():
320 318
  """Failover the master node.
b/scripts/gnt-node
53 53
  @return: the desired exit code
54 54

  
55 55
  """
56
  cl = GetClient()
56 57
  dns_data = utils.HostInfo(args[0])
57 58
  node = dns_data.name
58 59

  
59 60
  if not opts.readd:
60
    op = opcodes.OpQueryNodes(output_fields=['name'], names=[node])
61 61
    try:
62
      output = SubmitOpCode(op)
62
      output = cl.QueryNodes(names=[node], fields=['name'])
63 63
    except (errors.OpPrereqError, errors.OpExecError):
64 64
      pass
65 65
    else:
......
67 67
               " - please use --readd", args[0], output[0][0])
68 68
      return 1
69 69

  
70
  # read the cluster name from the master
71
  output = cl.QueryConfigValues(['cluster_name'])
72
  cluster_name = output[0]
73

  
70 74
  ToStderr("-- WARNING -- \n"
71 75
           "Performing this operation is going to replace the ssh daemon"
72 76
           " keypair\n"
......
74 78
           " current one\n"
75 79
           "and grant full intra-cluster ssh root access to/from it\n", node)
76 80

  
77
  bootstrap.SetupNodeDaemon(node, opts.ssh_key_check)
81
  bootstrap.SetupNodeDaemon(cluster_name, node, opts.ssh_key_check)
78 82

  
79 83
  op = opcodes.OpAddNode(node_name=args[0], secondary_ip=opts.secondary_ip,
80 84
                         readd=opts.readd)

Also available in: Unified diff