Browse Source

Configure compute params in config

Add a way to pass instance_discovery_method param to
override in the ceilo compute agent config.

Change-Id: Id7bd49510c0be76ed3f940c91108659beb440afb
changes/08/420908/7
Pradeep Kilambi 5 years ago
parent
commit
9cf46cbf92
  1. 19
      manifests/agent/compute.pp
  2. 27
      manifests/agent/polling.pp
  3. 9
      releasenotes/notes/add-instance-discovery-methods-5d4dde0ebf4cec28.yaml
  4. 16
      spec/classes/ceilometer_agent_compute_spec.rb
  5. 15
      spec/classes/ceilometer_agent_polling_spec.rb

19
manifests/agent/compute.pp

@ -17,16 +17,29 @@
# (Optional) ensure state for package.
# Defaults to 'present'.
#
# [*instance_discovery_method*]
# (Optional) method to discovery instances running on compute node
# Defaults to $::os_service_default
# * naive: poll nova to get all instances
# * workload_partitioning: poll nova to get instances of the compute
# * libvirt_metadata: get instances from libvirt metadata
# but without instance metadata (recommended for Gnocchi backend).
#
class ceilometer::agent::compute (
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$instance_discovery_method = $::os_service_default,
) inherits ceilometer {
warning('This class is deprecated. Please use ceilometer::agent::polling with compute namespace instead.')
include ::ceilometer::params
ceilometer_config {
'compute/instance_discovery_method': value => $instance_discovery_method,
}
Ceilometer_config<||> ~> Service['ceilometer-agent-compute']
Package['ceilometer-agent-compute'] -> Service['ceilometer-agent-compute']

27
manifests/agent/polling.pp

@ -32,14 +32,23 @@
# (Optional) The url to use for distributed group membership coordination.
# Defaults to undef.
#
# [*instance_discovery_method*]
# (Optional) method to discovery instances running on compute node
# Defaults to $::os_service_default
# * naive: poll nova to get all instances
# * workload_partitioning: poll nova to get instances of the compute
# * libvirt_metadata: get instances from libvirt metadata
# but without instance metadata (recommended for Gnocchi backend).
#
class ceilometer::agent::polling (
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$central_namespace = true,
$compute_namespace = true,
$ipmi_namespace = true,
$coordination_url = undef,
$manage_service = true,
$enabled = true,
$package_ensure = 'present',
$central_namespace = true,
$compute_namespace = true,
$ipmi_namespace = true,
$coordination_url = undef,
$instance_discovery_method = $::os_service_default,
) inherits ceilometer {
include ::ceilometer::deps
@ -65,6 +74,10 @@ class ceilometer::agent::polling (
Package <| title == 'ceilometer-common' |> -> User['ceilometer']
Package <| title == 'nova-common' |> -> Package['ceilometer-common']
ceilometer_config {
'compute/instance_discovery_method': value => $instance_discovery_method,
}
}
if $ipmi_namespace {

9
releasenotes/notes/add-instance-discovery-methods-5d4dde0ebf4cec28.yaml

@ -0,0 +1,9 @@
---
features:
- Add instance_discovery_method to ceilometer agent compute and polling
classes so this option is configurable.
upgrade:
- When upgrading, ensure that you dont have both the agent compute as well
as the polling classes initialized as that would trigger a duplicate
declaration. Ceilometer::agent::compute is deprecated and will be removed
in pike release.

16
spec/classes/ceilometer_agent_compute_spec.rb

@ -28,6 +28,10 @@ describe 'ceilometer::agent::compute' do
)
end
it 'configures agent compute default instance discovery' do
is_expected.to contain_ceilometer_config('compute/instance_discovery_method').with_value('<SERVICE DEFAULT>')
end
it 'adds ceilometer user to nova group and, if required, to libvirt group' do
if platform_params[:libvirt_group]
is_expected.to contain_user('ceilometer').with_groups(['nova', "#{platform_params[:libvirt_group]}"])
@ -68,6 +72,18 @@ describe 'ceilometer::agent::compute' do
end
end
context 'when setting instance_discovery_method' do
before do
params.merge!({ :instance_discovery_method => 'naive' })
end
it 'configures agent compute instance discovery' do
is_expected.to contain_ceilometer_config('compute/instance_discovery_method').with_value('naive')
end
end
context 'with disabled service managing' do
before do
params.merge!({

15
spec/classes/ceilometer_agent_polling_spec.rb

@ -38,6 +38,10 @@ describe 'ceilometer::agent::polling' do
:before => /Package\[ceilometer-common\]/
)
end
it 'configures agent compute' do
is_expected.to contain_ceilometer_config('compute/instance_discovery_method').with_value('<SERVICE DEFAULT>')
end
end
it 'installs ceilometer-polling package' do
@ -71,6 +75,17 @@ describe 'ceilometer::agent::polling' do
end
end
context 'when setting instance_discovery_method' do
before do
params.merge!({ :instance_discovery_method => 'naive' })
end
it 'configures agent compute instance discovery' do
is_expected.to contain_ceilometer_config('compute/instance_discovery_method').with_value('naive')
end
end
context 'with central and ipmi polling namespaces disabled' do
before do
params.merge!({

Loading…
Cancel
Save