Merge "Modify RemoteClient to use ssh validation config parameters"

This commit is contained in:
Jenkins 2015-07-02 15:50:26 +00:00 committed by Gerrit Code Review
commit c531932238
4 changed files with 18 additions and 31 deletions

View File

@ -290,18 +290,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
@ -313,9 +305,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
@ -1128,6 +1117,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)
@ -1135,9 +1125,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

@ -240,18 +240,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"
@ -263,9 +255,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?"),
@ -602,17 +591,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,