diff --git a/deployment_scripts/puppet/modules/lma_collector/README.md b/deployment_scripts/puppet/modules/lma_collector/README.md index 0bd502655..b662a0178 100644 --- a/deployment_scripts/puppet/modules/lma_collector/README.md +++ b/deployment_scripts/puppet/modules/lma_collector/README.md @@ -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 diff --git a/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py b/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py index 58f11d3bf..352c77774 100644 --- a/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py +++ b/deployment_scripts/puppet/modules/lma_collector/files/collectd/collectd_openstack.py @@ -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 = {} diff --git a/deployment_scripts/puppet/modules/lma_collector/manifests/collectd/openstack.pp b/deployment_scripts/puppet/modules/lma_collector/manifests/collectd/openstack.pp index 51949695c..009f69616 100644 --- a/deployment_scripts/puppet/modules/lma_collector/manifests/collectd/openstack.pp +++ b/deployment_scripts/puppet/modules/lma_collector/manifests/collectd/openstack.pp @@ -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 { diff --git a/deployment_scripts/puppet/modules/lma_collector/spec/defines/lma_collector_collectd_openstack_spec.rb b/deployment_scripts/puppet/modules/lma_collector/spec/defines/lma_collector_collectd_openstack_spec.rb index 592efa488..ac4b693cd 100644 --- a/deployment_scripts/puppet/modules/lma_collector/spec/defines/lma_collector_collectd_openstack_spec.rb +++ b/deployment_scripts/puppet/modules/lma_collector/spec/defines/lma_collector_collectd_openstack_spec.rb @@ -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