KVM test: Fix problem when unexpected strings appear on SSH prompt

In some conditions, ssh may respond things like:

Warning: Permanently added localhost' (RSA) to the list of known hosts.

Take that into account on the remote login function.

Signed-off-by: Jason D. Gaston <jason.d.gaston@intel.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@5341 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/virt/virt_utils.py b/client/virt/virt_utils.py
index 8fa64ca..398ecd4 100644
--- a/client/virt/virt_utils.py
+++ b/client/virt/virt_utils.py
@@ -557,7 +557,7 @@
             match, text = session.read_until_last_line_matches(
                 [r"[Aa]re you sure", r"[Pp]assword:\s*$", r"[Ll]ogin:\s*$",
                  r"[Cc]onnection.*closed", r"[Cc]onnection.*refused",
-                 r"[Pp]lease wait", prompt],
+                 r"[Pp]lease wait", r"[Ww]arning", prompt],
                 timeout=timeout, internal_timeout=0.5)
             if match == 0:  # "Are you sure you want to continue connecting"
                 logging.debug("Got 'Are you sure...'; sending 'yes'")
@@ -592,7 +592,10 @@
                 logging.debug("Got 'Please wait'")
                 timeout = 30
                 continue
-            elif match == 6:  # prompt
+            elif match == 6:  # "Warning added RSA"
+                logging.debug("Got 'Warning added RSA to known host list")
+                continue
+            elif match == 7:  # prompt
                 logging.debug("Got shell prompt -- logged in")
                 break
         except aexpect.ExpectTimeoutError, e: