Revision 651ce6a3 lib/client/gnt_cluster.py

b/lib/client/gnt_cluster.py
570 570
                               errors.ECODE_INVAL)
571 571

  
572 572
  cl = GetClient()
573
  try:
574
    cluster_name = cl.QueryConfigValues(["cluster_name"])[0]
573 575

  
574
  cluster_name = cl.QueryConfigValues(["cluster_name"])[0]
575

  
576
  results = GetOnlineNodes(nodes=opts.nodes, cl=cl, filter_master=True,
577
                           secondary_ips=opts.use_replication_network,
578
                           nodegroup=opts.nodegroup)
576
    results = GetOnlineNodes(nodes=opts.nodes, cl=cl, filter_master=True,
577
                             secondary_ips=opts.use_replication_network,
578
                             nodegroup=opts.nodegroup)
579
    ports = GetNodesSshPorts(opts.nodes, cl)
580
  finally:
581
    cl.Close()
579 582

  
580 583
  srun = ssh.SshRunner(cluster_name)
581
  for node in results:
582
    if not srun.CopyFileToNode(node, filename):
583
      ToStderr("Copy of file %s to node %s failed", filename, node)
584
  for (node, port) in zip(results, ports):
585
    if not srun.CopyFileToNode(node, port, filename):
586
      ToStderr("Copy of file %s to node %s:%d failed", filename, node, port)
584 587

  
585 588
  return 0
586 589

  
......
600 603
  command = " ".join(args)
601 604

  
602 605
  nodes = GetOnlineNodes(nodes=opts.nodes, cl=cl, nodegroup=opts.nodegroup)
606
  ports = GetNodesSshPorts(nodes, cl)
603 607

  
604 608
  cluster_name, master_node = cl.QueryConfigValues(["cluster_name",
605 609
                                                    "master_node"])
......
611 615
    nodes.remove(master_node)
612 616
    nodes.append(master_node)
613 617

  
614
  for name in nodes:
615
    result = srun.Run(name, constants.SSH_LOGIN_USER, command)
618
  for (name, port) in zip(nodes, ports):
619
    result = srun.Run(name, constants.SSH_LOGIN_USER, command, port=port)
616 620

  
617 621
    if opts.failure_only and result.exit_code == constants.EXIT_SUCCESS:
618 622
      # Do not output anything for successful commands
......
978 982

  
979 983
    if files_to_copy:
980 984
      for node_name in ctx.nonmaster_nodes:
981
        ctx.feedback_fn("Copying %s to %s" %
982
                        (", ".join(files_to_copy), node_name))
985
        port = ctx.ssh_ports[node_name]
986
        ctx.feedback_fn("Copying %s to %s:%d" %
987
                        (", ".join(files_to_copy), node_name, port))
983 988
        for file_name in files_to_copy:
984
          ctx.ssh.CopyFileToNode(node_name, file_name)
989
          ctx.ssh.CopyFileToNode(node_name, port, file_name)
985 990

  
986 991
  RunWhileClusterStopped(ToStdout, _RenewCryptoInner)
987 992

  

Also available in: Unified diff