Autotest has 2 implementations of SSH based hosts, the default,
that uses (raw_ssh) and another one based on the python SSH
library paramiko (paramiko). Currently one can choose Paramiko
based hosts only by modifying source code, which is less
convenient. Turn the 'ssh_engine' used by autoserv a configurable
option.
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3915 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/global_config.ini b/global_config.ini
index cc20a96..cb2ccd5 100644
--- a/global_config.ini
+++ b/global_config.ini
@@ -74,7 +74,12 @@
default_protection: NO_PROTECTION
[AUTOSERV]
-# Autotest server operators *really should* set this to True.
+# Autotest has 2 implementations of SSH based hosts, the default (raw_ssh), and
+# another one based on the python SSH library paramiko (paramiko).
+# You can change the default 'raw_ssh' to 'paramiko' if you want to.
+ssh_engine: raw_ssh
+# Autotest server operators *really should* set this to True, specially if
+# using ssh_engine 'paramiko'.
require_atfork_module: False
[PACKAGES]
diff --git a/server/hosts/factory.py b/server/hosts/factory.py
index da94410..1eb9b53 100644
--- a/server/hosts/factory.py
+++ b/server/hosts/factory.py
@@ -1,11 +1,13 @@
-from autotest_lib.client.common_lib import utils, error
+from autotest_lib.client.common_lib import utils, error, global_config
from autotest_lib.server import utils as server_utils
from autotest_lib.server.hosts import site_factory, ssh_host, serial
from autotest_lib.server.hosts import logfile_monitor
DEFAULT_FOLLOW_PATH = '/var/log/kern.log'
DEFAULT_PATTERNS_PATH = 'console_patterns'
-
+SSH_ENGINE = global_config.global_config.get_config_value('AUTOSERV',
+ 'ssh_engine',
+ type=str)
# for tracking which hostnames have already had job_start called
_started_hostnames = set()
@@ -14,7 +16,16 @@
hostname, auto_monitor=True, follow_paths=None, pattern_paths=None,
netconsole=False, **args):
# by default assume we're using SSH support
- classes = [ssh_host.SSHHost]
+ if SSH_ENGINE == 'paramiko':
+ from autotest_lib.server.hosts import paramiko_host
+ classes = [paramiko_host.ParamikoHost]
+ elif SSH_ENGINE == 'raw_ssh':
+ classes = [ssh_host.SSHHost]
+ else:
+ raise error.AutoServError("Unknown SSH engine %s. Please verify the "
+ "value of the configuration key 'ssh_engine' "
+ "on autotest's global_config.ini file." %
+ SSH_ENGINE)
# if the user really wants to use netconsole, let them
if netconsole: