Increase timeout to 20s for Openstack collectd plugins

And decrease the max_retries from 3 to 2 to stay in the 50 seconds window.
This change allows to retrieve large number of objects and also avoids to
overload the system by performing 3 'zombies' requests every 50 seconds
without any metrics collected.

Partial-bug: #1554502
Change-Id: I60a7611bc82598831538da01245b87fb29a15c44
This commit is contained in:
Swann Croiset 2016-03-09 11:10:27 +01:00
parent e2beeaeef8
commit 9cb06879fe
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