2 # Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
4 # Author: Emilien Macchi <emilien.macchi@enovance.com>
6 # Licensed under the Apache License, Version 2.0 (the "License"); you may
7 # not use this file except in compliance with the License. You may obtain
8 # a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 # License for the specific language governing permissions and limitations
18 # == Class: neutron::agents:metering
20 # Setups Neutron metering agent.
25 # (optional) Ensure state for package. Defaults to 'present'.
28 # (optional) Enable state for service. Defaults to 'true'.
31 # (optional) Whether to start/stop the service
35 # (optional) Show debugging output in log. Defaults to false.
37 # [*interface_driver*]
38 # (optional) Defaults to 'neutron.agent.linux.interface.OVSInterfaceDriver'.
41 # (optional) Allow overlapping IP (Must have kernel build with
42 # CONFIG_NET_NS=y and iproute2 package that supports namespaces).
45 # [*measure_interval*]
46 # (optional) Interval between two metering measures.
50 # (optional) Interval between two metering reports.
54 class neutron::agents::metering (
55 $package_ensure = present,
57 $manage_service = true,
59 $interface_driver = 'neutron.agent.linux.interface.OVSInterfaceDriver',
60 $use_namespaces = true,
61 $measure_interval = '30',
62 $report_interval = '300'
65 include neutron::params
67 Neutron_config<||> ~> Service['neutron-metering-service']
68 Neutron_metering_agent_config<||> ~> Service['neutron-metering-service']
70 # The metering agent loads both neutron.ini and its own file.
71 # This only lists config specific to the agent. neutron.ini supplies
73 neutron_metering_agent_config {
74 'DEFAULT/debug': value => $debug;
75 'DEFAULT/interface_driver': value => $interface_driver;
76 'DEFAULT/use_namespaces': value => $use_namespaces;
77 'DEFAULT/measure_interval': value => $measure_interval;
78 'DEFAULT/report_interval': value => $report_interval;
81 if $::neutron::params::metering_agent_package {
82 Package['neutron'] -> Package['neutron-metering-agent']
83 Package['neutron-metering-agent'] -> Neutron_config<||>
84 Package['neutron-metering-agent'] -> Neutron_metering_agent_config<||>
85 package { 'neutron-metering-agent':
86 ensure => $package_ensure,
87 name => $::neutron::params::metering_agent_package,
90 # Default dependency if the system does not provide a neutron metering agent package.
91 Package['neutron'] -> Neutron_metering_agent_config<||>
96 $service_ensure = 'running'
98 $service_ensure = 'stopped'
102 service { 'neutron-metering-service':
103 ensure => $service_ensure,
104 name => $::neutron::params::metering_agent_service,
106 require => Class['neutron'],