Add config of metadata for ovs plugin
Change-Id: I206247eccb952f5ae528843d3f50035fc72d6ff0
This commit is contained in:
parent
91466b45ac
commit
27845d7f19
|
@ -40,7 +40,7 @@ monasca is a combination of Puppet manifest that configures the monasca client a
|
|||
|
||||
#### monasca_config
|
||||
|
||||
The `monasca_config` provider is a children of the ini_setting provider. It allows one to write an entry in the `/etc/monasca/monasca.conf` file.
|
||||
The `monasca_config` provider is a child of the ini_setting provider. It allows one to write an entry in the `/etc/monasca/monasca.conf` file.
|
||||
|
||||
```puppet
|
||||
monasca_config { 'DEFAULT/debug' :
|
||||
|
|
|
@ -27,6 +27,13 @@
|
|||
# (Optional) Cache directory to persist data.
|
||||
# Defaults to /dev/shm.
|
||||
#
|
||||
# [*metadata*]
|
||||
# (Optional) A list of router metadata to be submitted as dimensions
|
||||
# with service data. For example, 'tenant_name' in the list will
|
||||
# add the tenant name dimension to router metrics posted to the
|
||||
# infrastructure project.
|
||||
# Defaults to an empty list in the config file.
|
||||
#
|
||||
# [*neutron_refresh*]
|
||||
# (Optional) Interval to force data refresh from neutron.
|
||||
# Defaults to 14400 seconds (4 hours)..
|
||||
|
@ -67,6 +74,7 @@ class monasca::checks::ovs(
|
|||
$check_router_ha = true,
|
||||
$identity_uri = undef,
|
||||
$included_interface_re = 'qg.*',
|
||||
$metadata = [],
|
||||
$network_use_bits = true,
|
||||
$neutron_refresh = '14400',
|
||||
$ovs_cmd = 'sudo /usr/bin/ovs-vsctl',
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'monasca::checks::ovs' do
|
||||
describe 'on debian platforms' do
|
||||
let :facts do
|
||||
@default_facts.merge({
|
||||
:osfamily => 'Debian',
|
||||
})
|
||||
end
|
||||
|
||||
let :ovs_file do
|
||||
"/etc/monasca/agent/conf.d/ovs.yaml"
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'monasca::agent':
|
||||
url => 'http://127.0.0.1',
|
||||
username => 'user',
|
||||
password => 'password',
|
||||
keystone_url => 'http://127.0.0.1:5000',
|
||||
install_python_deps => false,
|
||||
}"
|
||||
end
|
||||
|
||||
let(:params) { {
|
||||
:admin_password => 'password',
|
||||
:admin_tenant_name => 'tenant_name',
|
||||
:admin_user => 'user',
|
||||
:identity_uri => 'uri',
|
||||
:metadata => ['tenant_name'],
|
||||
} }
|
||||
|
||||
it 'builds the ovs config file properly' do
|
||||
is_expected.to contain_file(ovs_file).with_content(/^\s*admin_password: password$/)
|
||||
is_expected.to contain_file(ovs_file).with_content(/^\s*admin_tenant_name: tenant_name$/)
|
||||
is_expected.to contain_file(ovs_file).with_content(/^\s*admin_user: user$/)
|
||||
is_expected.to contain_file(ovs_file).with_content(/^\s*cache_dir: \/dev\/shm$/)
|
||||
is_expected.to contain_file(ovs_file).with_content(/^\s*identity_uri: uri$/)
|
||||
is_expected.to contain_file(ovs_file).with_content(/^\s*network_use_bits: true$/)
|
||||
is_expected.to contain_file(ovs_file).with_content(/^\s*metadata: \["tenant_name"\]$/)
|
||||
is_expected.to contain_file(ovs_file).with_content(/^\s*neutron_refresh: 14400$/)
|
||||
is_expected.to contain_file(ovs_file).with_content(/^\s*ovs_cmd: 'sudo \/usr\/bin\/ovs-vsctl'$/)
|
||||
is_expected.to contain_file(ovs_file).with_content(/^\s*included_interface_re: qg\.\*$/)
|
||||
is_expected.to contain_file(ovs_file).with_content(/^\s*use_absolute_metrics: true$/)
|
||||
is_expected.to contain_file(ovs_file).with_content(/^\s*use_rate_metrics: true$/)
|
||||
is_expected.to contain_file(ovs_file).with_content(/^\s*use_health_metrics: true$/)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,8 +1,12 @@
|
|||
# Load libraries from openstacklib here to simulate how they live together in a real puppet run (for provider unit tests)
|
||||
$LOAD_PATH.push(File.join(File.dirname(__FILE__), 'fixtures', 'modules', 'openstacklib', 'lib'))
|
||||
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
require 'shared_examples'
|
||||
require 'puppet-openstack_spec_helper/facts'
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.alias_it_should_behave_like_to :it_configures, 'configures'
|
||||
c.alias_it_should_behave_like_to :it_raises, 'raises'
|
||||
c.default_facts = { :concat_basedir => '/var/lib/puppet/concat' }
|
||||
end
|
||||
|
||||
at_exit { RSpec::Puppet::Coverage.report! }
|
||||
|
|
|
@ -6,6 +6,9 @@ init_config:
|
|||
cache_dir: <%= @cache_dir %>
|
||||
check_router_ha: <%= @check_router_ha %>
|
||||
identity_uri: <%= @identity_uri %>
|
||||
<%- if @metadata -%>
|
||||
metadata: <%= @metadata %>
|
||||
<%- end -%>
|
||||
network_use_bits: <%= @network_use_bits %>
|
||||
neutron_refresh: <%= @neutron_refresh %>
|
||||
ovs_cmd: '<%= @ovs_cmd %>'
|
||||
|
|
|
@ -15,19 +15,19 @@
|
|||
PATH=$PATH:/usr/local/bin # supervisord might live here
|
||||
PATH=$PATH:/sbin
|
||||
|
||||
AGENTPATH="<%= virtual_env %>/bin/monasca-collector"
|
||||
AGENTCONF="<%= agent_dir %>/agent.yaml"
|
||||
MONASCASTATSDPATH="<%= virtual_env %>/bin/monasca-statsd"
|
||||
AGENTUSER="<%= agent_user %>"
|
||||
FORWARDERPATH="<%= virtual_env %>/bin/monasca-forwarder"
|
||||
AGENTPATH="<%= @virtual_env %>/bin/monasca-collector"
|
||||
AGENTCONF="<%= @agent_dir %>/agent.yaml"
|
||||
MONASCASTATSDPATH="<%= @virtual_env %>/bin/monasca-statsd"
|
||||
AGENTUSER="<%= @agent_user %>"
|
||||
FORWARDERPATH="<%= @virtual_env %>/bin/monasca-forwarder"
|
||||
NAME="monasca-agent"
|
||||
DESC="Monasca Monitoring Agent"
|
||||
AGENT_PID_PATH="/var/tmp/monasca-agent.pid"
|
||||
SUPERVISOR_PIDFILE="/var/tmp/monasca-agent-supervisord.pid"
|
||||
SUPERVISOR_FILE="<%= agent_dir %>/supervisor.conf"
|
||||
SUPERVISOR_FILE="<%= @agent_dir %>/supervisor.conf"
|
||||
SUPERVISOR_SOCK="/var/tmp/monasca-agent-supervisor.sock"
|
||||
SUPERVISORD="<%= virtual_env %>/bin/supervisord"
|
||||
SUPERVISORCTL="<%= virtual_env %>/bin/supervisorctl"
|
||||
SUPERVISORD="<%= @virtual_env %>/bin/supervisord"
|
||||
SUPERVISORCTL="<%= @virtual_env %>/bin/supervisorctl"
|
||||
|
||||
# This script is considered a configuration file and will not be
|
||||
# removed by dpkg unless the --purge option it set. Therefore we
|
||||
|
|
|
@ -11,37 +11,37 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
|||
minfds = 1024
|
||||
minprocs = 200
|
||||
loglevel = info
|
||||
logfile = <%= log_dir %>/supervisord.log
|
||||
logfile = <%= @log_dir %>/supervisord.log
|
||||
logfile_maxbytes = 50MB
|
||||
nodaemon = false
|
||||
pidfile = /var/run/monasca-agent-supervisord.pid
|
||||
logfile_backups = 10
|
||||
|
||||
[program:collector]
|
||||
command=<%= virtual_env %>/bin/monasca-collector foreground
|
||||
command=<%= @virtual_env %>/bin/monasca-collector foreground
|
||||
stdout_logfile=NONE
|
||||
stderr_logfile=NONE
|
||||
priority=999
|
||||
startsecs=2
|
||||
user=<%= agent_user %>
|
||||
user=<%= @agent_user %>
|
||||
autorestart=true
|
||||
|
||||
[program:forwarder]
|
||||
command=<%= virtual_env %>/bin/monasca-forwarder
|
||||
command=<%= @virtual_env %>/bin/monasca-forwarder
|
||||
stdout_logfile=NONE
|
||||
stderr_logfile=NONE
|
||||
startsecs=3
|
||||
priority=998
|
||||
user=<%= agent_user %>
|
||||
user=<%= @agent_user %>
|
||||
autorestart=true
|
||||
|
||||
[program:statsd]
|
||||
command=<%= virtual_env %>/bin/monasca-statsd
|
||||
command=<%= @virtual_env %>/bin/monasca-statsd
|
||||
stdout_logfile=NONE
|
||||
stderr_logfile=NONE
|
||||
startsecs=3
|
||||
priority=998
|
||||
user=<%= agent_user %>
|
||||
user=<%= @agent_user %>
|
||||
autorestart=true
|
||||
|
||||
[group:monasca-agent]
|
||||
|
|
Loading…
Reference in New Issue