puppet-neutron/manifests/agents/metering.pp

110 lines
3.2 KiB
Puppet

#
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Emilien Macchi <emilien.macchi@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# == Class: neutron::agents:metering
#
# Setups Neutron metering agent.
#
# === Parameters
#
# [*package_ensure*]
# (optional) Ensure state for package. Defaults to 'present'.
#
# [*enabled*]
# (optional) Enable state for service. Defaults to 'true'.
#
# [*manage_service*]
# (optional) Whether to start/stop the service
# Defaults to true
#
# [*debug*]
# (optional) Show debugging output in log. Defaults to $::os_service_default.
#
# [*interface_driver*]
# (optional) Defaults to 'neutron.agent.linux.interface.OVSInterfaceDriver'.
#
# [*driver*]
# (optional) Defaults to 'neutron.services.metering.drivers.noop.noop_driver.NoopMeteringDriver'.
#
# [*measure_interval*]
# (optional) Interval between two metering measures.
# Defaults to 30.
#
# [*report_interval*]
# (optional) Interval between two metering reports.
# Defaults to 300.
#
# [*purge_config*]
# (optional) Whether to set only the specified config options
# in the metering config.
# Defaults to false.
#
class neutron::agents::metering (
$package_ensure = present,
$enabled = true,
$manage_service = true,
$debug = $::os_service_default,
$interface_driver = 'neutron.agent.linux.interface.OVSInterfaceDriver',
$driver = 'neutron.services.metering.drivers.noop.noop_driver.NoopMeteringDriver',
$measure_interval = $::os_service_default,
$report_interval = $::os_service_default,
$purge_config = false,
) {
include neutron::deps
include neutron::params
resources { 'neutron_metering_agent_config':
purge => $purge_config,
}
# The metering agent loads both neutron.conf and its own file.
# This only lists config specific to the agent. neutron.conf supplies
# the rest.
neutron_metering_agent_config {
'DEFAULT/debug': value => $debug;
'DEFAULT/interface_driver': value => $interface_driver;
'DEFAULT/driver': value => $driver;
'DEFAULT/measure_interval': value => $measure_interval;
'DEFAULT/report_interval': value => $report_interval;
}
if $::neutron::params::metering_agent_package {
package { 'neutron-metering-agent':
ensure => $package_ensure,
name => $::neutron::params::metering_agent_package,
tag => ['openstack', 'neutron-package'],
}
}
if $manage_service {
if $enabled {
$service_ensure = 'running'
} else {
$service_ensure = 'stopped'
}
}
service { 'neutron-metering-service':
ensure => $service_ensure,
name => $::neutron::params::metering_agent_service,
enable => $enabled,
tag => 'neutron-service',
}
}