Modify RemoteClient to use ssh validation config parameters

This patch implements changes needed to remove the usage of
deprecated tempest ssh configuration parameters and replace it
with the parameters set by ssh auth strategy blueprint

Partially implements: blueprint ssh-auth-strategy

Change-Id: I558a04b0bb61ecf8e428a0f682fbb42a67695318
This commit is contained in:
nithya-ganesan 2015-02-08 23:13:48 +00:00
parent 7c2118ba0f
commit 67da287113
4 changed files with 18 additions and 31 deletions

View File

@ -284,18 +284,10 @@
# (integer value)
#ping_count = 1
# Timeout in seconds to wait for authentication to succeed. (integer
# value)
#ssh_timeout = 300
# Additional wait time for clean state, when there is no OS-EXT-STS
# extension available (integer value)
#ready_wait = 0
# Timeout in seconds to wait for output from ssh channel. (integer
# value)
#ssh_channel_timeout = 60
# Name of the fixed network that is visible to all test tenants. If
# multiple networks are available for a tenant this is the network
# which will be used for creating servers if tempest does not create a
@ -307,9 +299,6 @@
# use_floatingip_for_ssh=true or run_validation=false. (string value)
#network_for_ssh = public
# IP version used for SSH connections. (integer value)
#ip_version_for_ssh = 4
# Does SSH use Floating IPs? (boolean value)
#use_floatingip_for_ssh = true
@ -1115,6 +1104,7 @@
#auth_method = keypair
# Default IP version for ssh connections. (integer value)
# Deprecated group/name - [compute]/ip_version_for_ssh
#ip_version_for_ssh = 4
# Timeout in seconds to wait for ping to succeed. (integer value)
@ -1122,9 +1112,11 @@
# Timeout in seconds to wait for the TCP connection to be successful.
# (integer value)
# Deprecated group/name - [compute]/ssh_channel_timeout
#connect_timeout = 60
# Timeout in seconds to wait for the ssh banner. (integer value)
# Deprecated group/name - [compute]/ssh_timeout
#ssh_timeout = 300

View File

@ -30,10 +30,10 @@ class RemoteClient(object):
# NOTE(afazekas): It should always get an address instead of server
def __init__(self, server, username, password=None, pkey=None):
ssh_timeout = CONF.compute.ssh_timeout
ssh_timeout = CONF.validation.ssh_timeout
network = CONF.compute.network_for_ssh
ip_version = CONF.compute.ip_version_for_ssh
ssh_channel_timeout = CONF.compute.ssh_channel_timeout
ip_version = CONF.validation.ip_version_for_ssh
connect_timeout = CONF.validation.connect_timeout
if isinstance(server, six.string_types):
ip_address = server
else:
@ -46,7 +46,7 @@ class RemoteClient(object):
raise exceptions.ServerUnreachable()
self.ssh_client = ssh.Client(ip_address, username, password,
ssh_timeout, pkey=pkey,
channel_timeout=ssh_channel_timeout)
channel_timeout=connect_timeout)
def exec_command(self, cmd):
# Shell options below add more clearness on failures,

View File

@ -239,18 +239,10 @@ ComputeGroup = [
default=1,
help="The number of ping packets originating from remote "
"linux hosts"),
cfg.IntOpt('ssh_timeout',
default=300,
help="Timeout in seconds to wait for authentication to "
"succeed."),
cfg.IntOpt('ready_wait',
default=0,
help="Additional wait time for clean state, when there is "
"no OS-EXT-STS extension available"),
cfg.IntOpt('ssh_channel_timeout',
default=60,
help="Timeout in seconds to wait for output from ssh "
"channel."),
cfg.StrOpt('fixed_network_name',
help="Name of the fixed network that is visible to all test "
"tenants. If multiple networks are available for a tenant"
@ -262,9 +254,6 @@ ComputeGroup = [
default='public',
help="Network used for SSH connections. Ignored if "
"use_floatingip_for_ssh=true or run_validation=false."),
cfg.IntOpt('ip_version_for_ssh',
default=4,
help="IP version used for SSH connections."),
cfg.BoolOpt('use_floatingip_for_ssh',
default=True,
help="Does SSH use Floating IPs?"),
@ -594,17 +583,23 @@ ValidationGroup = [
'Additional methods will be handled in a separate spec.'),
cfg.IntOpt('ip_version_for_ssh',
default=4,
help='Default IP version for ssh connections.'),
help='Default IP version for ssh connections.',
deprecated_opts=[cfg.DeprecatedOpt('ip_version_for_ssh',
group='compute')]),
cfg.IntOpt('ping_timeout',
default=120,
help='Timeout in seconds to wait for ping to succeed.'),
cfg.IntOpt('connect_timeout',
default=60,
help='Timeout in seconds to wait for the TCP connection to be '
'successful.'),
'successful.',
deprecated_opts=[cfg.DeprecatedOpt('ssh_channel_timeout',
group='compute')]),
cfg.IntOpt('ssh_timeout',
default=300,
help='Timeout in seconds to wait for the ssh banner.'),
help='Timeout in seconds to wait for the ssh banner.',
deprecated_opts=[cfg.DeprecatedOpt('ssh_timeout',
group='compute')]),
]
volume_group = cfg.OptGroup(name='volume',

View File

@ -28,9 +28,9 @@ class TestRemoteClient(base.TestCase):
super(TestRemoteClient, self).setUp()
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
cfg.CONF.set_default('ip_version_for_ssh', 4, group='compute')
cfg.CONF.set_default('ip_version_for_ssh', 4, group='validation')
cfg.CONF.set_default('network_for_ssh', 'public', group='compute')
cfg.CONF.set_default('ssh_channel_timeout', 1, group='compute')
cfg.CONF.set_default('connect_timeout', 1, group='validation')
self.conn = remote_client.RemoteClient('127.0.0.1', 'user', 'pass')
self.ssh_mock = self.useFixture(mockpatch.PatchObject(self.conn,