From 049a6c6be6bd9e38e74b8113c886025d9a44f9e7 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Sat, 6 Apr 2013 21:33:15 +0200
Subject: [PATCH] qa: pass some extra options to make scp work

scp by itself won't work on a cluster: a few extra options are needed to
tell it where to find the "right" ssh global known hosts file managed by
Ganeti.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
---
 qa/qa_instance.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/qa/qa_instance.py b/qa/qa_instance.py
index 9dbe5deca..0f3b8771e 100644
--- a/qa/qa_instance.py
+++ b/qa/qa_instance.py
@@ -607,6 +607,8 @@ def TestInstanceModifyPrimaryAndBack(instance, currentnode, othernode):
     print qa_utils.FormatInfo("Test only supported for the file disk template")
     return
 
+  cluster_name = qa_config.get("name")
+
   name = instance.name
   current = currentnode.primary
   other = othernode.primary
@@ -619,7 +621,11 @@ def TestInstanceModifyPrimaryAndBack(instance, currentnode, othernode):
   AssertCommand(["gnt-instance", "modify", "--new-primary=%s" % other, name],
                 fail=True)
   AssertCommand(["gnt-instance", "shutdown", name])
-  AssertCommand(["scp", "-r", disk, "%s:%s" % (other, filestorage)])
+  AssertCommand(["scp", "-oGlobalKnownHostsFile=%s" %
+                 pathutils.SSH_KNOWN_HOSTS_FILE,
+                 "-oCheckHostIp=no", "-oStrictHostKeyChecking=yes",
+                 "-oHashKnownHosts=no", "-oHostKeyAlias=%s" % cluster_name,
+                 "-r", disk, "%s:%s" % (other, filestorage)])
   AssertCommand(["gnt-instance", "modify", "--new-primary=%s" % other, name])
   AssertCommand(["gnt-instance", "startup", name])
 
-- 
GitLab