From 7bff16bd9f168216d79def9301d323f4b88a0643 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 20 Aug 2010 14:09:44 +0200
Subject: [PATCH] setup-ssh: only read the ssh port once
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Then reuse it. With certain setups, this could be slow when pre-seeding
an entire cluster.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 tools/setup-ssh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/setup-ssh b/tools/setup-ssh
index e28509250..02b6fbf7f 100755
--- a/tools/setup-ssh
+++ b/tools/setup-ssh
@@ -220,6 +220,7 @@ def main():
   SetupLogging(options)
 
   passwd = getpass.getpass(prompt="%s password:" % constants.GANETI_RUNAS)
+  ssh_port = netutils.GetDaemonPort("ssh")
 
   # Below, we need to join() the transport objects, as otherwise the
   # following happens:
@@ -231,7 +232,7 @@ def main():
   #   now
 
   for host in args:
-    transport = paramiko.Transport((host, netutils.GetDaemonPort("ssh")))
+    transport = paramiko.Transport((host, ssh_port))
     try:
       transport.connect(username=constants.GANETI_RUNAS, password=passwd)
     except Exception, err:
-- 
GitLab