| Index: client/virt/virt_utils.py
|
| diff --git a/client/tests/kvm/kvm_utils.py b/client/virt/virt_utils.py
|
| similarity index 98%
|
| rename from client/tests/kvm/kvm_utils.py
|
| rename to client/virt/virt_utils.py
|
| index 38c4afe335ce7bcb720749416b9bc82777d95010..97a652d9eff6b7c9b6b7e6889f7b216efd2ad843 100644
|
| --- a/client/tests/kvm/kvm_utils.py
|
| +++ b/client/virt/virt_utils.py
|
| @@ -5,11 +5,10 @@ KVM test utility functions.
|
| """
|
|
|
| import time, string, random, socket, os, signal, re, logging, commands, cPickle
|
| -import fcntl, shelve, ConfigParser, rss_file_transfer, threading, sys, UserDict
|
| -import inspect
|
| +import fcntl, shelve, ConfigParser, threading, sys, UserDict, inspect
|
| from autotest_lib.client.bin import utils, os_dep
|
| from autotest_lib.client.common_lib import error, logging_config
|
| -import kvm_subprocess
|
| +import rss_client, aexpect
|
| try:
|
| import koji
|
| KOJI_INSTALLED = True
|
| @@ -596,9 +595,9 @@ def _remote_login(session, username, password, prompt, timeout=10):
|
| elif match == 6: # prompt
|
| logging.debug("Got shell prompt -- logged in")
|
| break
|
| - except kvm_subprocess.ExpectTimeoutError, e:
|
| + except aexpect.ExpectTimeoutError, e:
|
| raise LoginTimeoutError(e.output)
|
| - except kvm_subprocess.ExpectProcessTerminatedError, e:
|
| + except aexpect.ExpectProcessTerminatedError, e:
|
| raise LoginProcessTerminatedError(e.status, e.output)
|
|
|
|
|
| @@ -635,7 +634,7 @@ def remote_login(client, host, port, username, password, prompt, linesep="\n",
|
| raise LoginBadClientError(client)
|
|
|
| logging.debug("Trying to login with command '%s'", cmd)
|
| - session = kvm_subprocess.ShellSession(cmd, linesep=linesep, prompt=prompt)
|
| + session = aexpect.ShellSession(cmd, linesep=linesep, prompt=prompt)
|
| try:
|
| _remote_login(session, username, password, prompt, timeout)
|
| except:
|
| @@ -736,12 +735,12 @@ def _remote_scp(session, password_list, transfer_timeout=600, login_timeout=10):
|
| text)
|
| elif match == 2: # "lost connection"
|
| raise SCPError("SCP client said 'lost connection'", text)
|
| - except kvm_subprocess.ExpectTimeoutError, e:
|
| + except aexpect.ExpectTimeoutError, e:
|
| if authentication_done:
|
| raise SCPTransferTimeoutError(e.output)
|
| else:
|
| raise SCPAuthenticationTimeoutError(e.output)
|
| - except kvm_subprocess.ExpectProcessTerminatedError, e:
|
| + except aexpect.ExpectProcessTerminatedError, e:
|
| if e.status == 0:
|
| logging.debug("SCP process terminated with status 0")
|
| break
|
| @@ -775,7 +774,7 @@ def remote_scp(command, password_list, log_filename=None, transfer_timeout=600,
|
| else:
|
| output_func = None
|
| output_params = ()
|
| - session = kvm_subprocess.Expect(command,
|
| + session = aexpect.Expect(command,
|
| output_func=output_func,
|
| output_params=output_params)
|
| try:
|
| @@ -880,7 +879,7 @@ def copy_files_to(address, client, username, password, port, local_path,
|
| log_func = None
|
| if verbose:
|
| log_func = logging.debug
|
| - c = rss_file_transfer.FileUploadClient(address, port, log_func)
|
| + c = rss_client.FileUploadClient(address, port, log_func)
|
| c.upload(local_path, remote_path, timeout)
|
| c.close()
|
|
|
| @@ -909,7 +908,7 @@ def copy_files_from(address, client, username, password, port, remote_path,
|
| log_func = None
|
| if verbose:
|
| log_func = logging.debug
|
| - c = rss_file_transfer.FileDownloadClient(address, port, log_func)
|
| + c = rss_client.FileDownloadClient(address, port, log_func)
|
| c.download(remote_path, local_path, timeout)
|
| c.close()
|
|
|
| @@ -1323,14 +1322,14 @@ def parallel(targets):
|
| return [t.join() for t in threads]
|
|
|
|
|
| -class KvmLoggingConfig(logging_config.LoggingConfig):
|
| +class VirtLoggingConfig(logging_config.LoggingConfig):
|
| """
|
| Used with the sole purpose of providing convenient logging setup
|
| for the KVM test auxiliary programs.
|
| """
|
| def configure_logging(self, results_dir=None, verbose=False):
|
| - super(KvmLoggingConfig, self).configure_logging(use_console=True,
|
| - verbose=verbose)
|
| + super(VirtLoggingConfig, self).configure_logging(use_console=True,
|
| + verbose=verbose)
|
|
|
|
|
| class PciAssignable(object):
|
|
|