In order to let the serial console work, we must let the remote_login() send the username when needed. Signed-off-by: Jason Wang <jasowang@xxxxxxxxxx> --- client/tests/kvm/kvm_utils.py | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py index 9adbaee..1ea0852 100644 --- a/client/tests/kvm/kvm_utils.py +++ b/client/tests/kvm/kvm_utils.py @@ -452,7 +452,7 @@ def check_kvm_source_dir(source_dir): # guests. def remote_login(command, password, prompt, linesep="\n", timeout=10, - prompt_assist = None): + prompt_assist = None, username = None): """ Log into a remote host (guest) using SSH or Telnet. Run the given command using kvm_spawn and provide answers to the questions asked. If timeout @@ -471,6 +471,8 @@ def remote_login(command, password, prompt, linesep="\n", timeout=10, password prompt, the shell prompt, etc) @prarm prompt_assist: An assistant string sent before the pattern matching in order to get the prompt for some kinds of shell_client. + @param username: The user name used to log into the session + @return Return the kvm_spawn object on success and None on failure. """ sub = kvm_subprocess.kvm_shell_session(command, @@ -505,9 +507,13 @@ def remote_login(command, password, prompt, linesep="\n", timeout=10, sub.close() return None elif match == 2: # "login:" - logging.debug("Got unexpected login prompt") - sub.close() - return None + if username is None: + logging.debug("Got unexpected login prompt") + sub.close() + return None + else: + sub.sendline(username) + continue elif match == 3: # "Connection closed" logging.debug("Got 'Connection closed'") sub.close() -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html