Merge "Increase timeout to 20s for Openstack collectd plugins"

This commit is contained in:
Jenkins 2016-03-14 14:52:42 +00:00 committed by Gerrit Code Review
commit a9fdabb520
4 changed files with 20 additions and 10 deletions

View File

@ -952,7 +952,10 @@ The resource title should be set to the service name (e.g. `'nova'`).
a string.
* `timeout`: *Optional*. Timeout in seconds beyond which the collector
considers that the endpoint doesn't respond. Valid options: an integer.
Default: 5.
Default: 20.
* `max_retries`: *Optional*. Number of maximum retries when an error occurs
(including timeout). Valid options: an integer.
Default: 2.
* `pacemaker_master_resource`: *Optional*. Name of the pacemaker resource used
to determine if the collecting of statistics should be active. This is
a parameter for advanced users. For this to function the

View File

@ -151,6 +151,10 @@ class CollectdPlugin(base.Base):
def __init__(self, *args, **kwargs):
super(CollectdPlugin, self).__init__(*args, **kwargs)
# The timeout/max_retries are defined according to the observations on
# 200 nodes environments with 600 VMs. See #1554502 for details.
self.timeout = 20
self.max_retries = 2
self.os_client = None
self.extra_config = {}

View File

@ -18,7 +18,8 @@ define lma_collector::collectd::openstack (
$password,
$tenant,
$keystone_url,
$timeout = undef,
$timeout = 20,
$max_retries = 2,
$pacemaker_master_resource = undef,
) {
@ -32,17 +33,16 @@ define lma_collector::collectd::openstack (
fail("service '${service}' is not supported")
}
$real_timeout = $timeout ? {
undef => $lma_collector::params::openstack_client_timeout,
default => $timeout,
}
validate_integer($timeout)
validate_integer($max_retries)
$config = {
'Username' => "\"${user}\"",
'Password' => "\"${password}\"",
'Tenant' => "\"${tenant}\"",
'KeystoneUrl' => "\"${keystone_url}\"",
'Timeout' => "\"${real_timeout}\"",
'Timeout' => "\"${timeout}\"",
'MaxRetries' => "\"${max_retries}\"",
}
if $pacemaker_master_resource {

View File

@ -28,18 +28,21 @@ describe 'lma_collector::collectd::openstack' do
.with_config({"Username" => '"user"', "Password" => '"password"',
"Tenant" => '"tenant"',
"KeystoneUrl" => '"http://example.com/keystone"',
"Timeout" => '"5"'}) }
"Timeout" => '"20"',
"MaxRetries" => '"2"'}) }
end
describe 'with required and optional params' do
let(:title) { :nova }
let(:params) {{:user => "user", :password => "password", :tenant => "tenant",
:keystone_url => "http://example.com/keystone",
:timeout => 10, :pacemaker_master_resource => "vip__management"}}
:timeout => 10, :max_retries => 1,
:pacemaker_master_resource => "vip__management"}}
it { is_expected.to contain_lma_collector__collectd__python('openstack_nova') \
.with_config({"Username" => '"user"', "Password" => '"password"',
"Tenant" => '"tenant"',
"KeystoneUrl" => '"http://example.com/keystone"',
"Timeout" => '"10"', "DependsOnResource" => '"vip__management"'}) }
"Timeout" => '"10"', "MaxRetries" => '"1"',
"DependsOnResource" => '"vip__management"'}) }
end
end