The tests which containing ssh session will be blocked by host key
checking if the incoming ssh host keys are not listed in known_hosts
file of guest, So disable the checking.

Signed-off-by: Lin Ma <[email protected]>
---
 virttest/remote.py    | 4 ++++
 virttest/utils_env.py | 1 +
 2 files changed, 5 insertions(+)

diff --git a/virttest/remote.py b/virttest/remote.py
index 66cb26e..99a3f6e 100644
--- a/virttest/remote.py
+++ b/virttest/remote.py
@@ -207,6 +207,7 @@ def remote_login(client, host, port, username, password, 
prompt, linesep="\n",
     """
     if client == "ssh":
         cmd = ("ssh -o UserKnownHostsFile=/dev/null "
+               "-o StrictHostKeyChecking=no "
                "-o PreferredAuthentications=password -p %s %s@%s" %
                (port, username, host))
     elif client == "telnet":
@@ -388,6 +389,7 @@ def scp_to_remote(host, port, username, password, 
local_path, remote_path,
         limit = "-l %s" % (limit)
 
     command = ("scp -v -o UserKnownHostsFile=/dev/null "
+               "-o StrictHostKeyChecking=no "
                "-o PreferredAuthentications=password -r %s "
                "-P %s %s %s@\[%s\]:%s" %
                (limit, port, local_path, username, host, remote_path))
@@ -416,6 +418,7 @@ def scp_from_remote(host, port, username, password, 
remote_path, local_path,
         limit = "-l %s" % (limit)
 
     command = ("scp -v -o UserKnownHostsFile=/dev/null "
+               "-o StrictHostKeyChecking=no "
                "-o PreferredAuthentications=password -r %s "
                "-P %s %s@\[%s\]:%s %s" %
                (limit, port, username, host, remote_path, local_path))
@@ -446,6 +449,7 @@ def scp_between_remotes(src, dst, port, s_passwd, d_passwd, 
s_name, d_name,
         limit = "-l %s" % (limit)
 
     command = ("scp -v -o UserKnownHostsFile=/dev/null -o "
+               "-o StrictHostKeyChecking=no "
                "PreferredAuthentications=password -r %s -P %s"
                " %s@\[%s\]:%s %s@\[%s\]:%s" %
                (limit, port, s_name, src, s_path, d_name, dst, d_path))
diff --git a/virttest/utils_env.py b/virttest/utils_env.py
index 9355c46..9ae0642 100644
--- a/virttest/utils_env.py
+++ b/virttest/utils_env.py
@@ -303,6 +303,7 @@ class Env(UserDict.IterableUserDict):
         cmd = "%s -npvvvi any 'port 68'" % utils_misc.find_command("tcpdump")
         if self._params.get("remote_preprocess") == "yes":
             login_cmd = ("ssh -o UserKnownHostsFile=/dev/null -o "
+                         "-o StrictHostKeyChecking=no "
                          "PreferredAuthentications=password -p %s %s@%s" %
                          (port, username, address))
 
-- 
1.8.4

_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to