Skip to content

Commit

Permalink
Closes-Bug: #1451527 - Provision Ceilometer using Smgr
Browse files Browse the repository at this point in the history
Patch 1:
- New contrail param - enable_ceilometer
- /etc/ceilometer/ceilometer.conf correctly configured on openstack & compute nodes
- Mongodb installed on database nodes

Patch 2:
- Review comments on Patch 1
- Moved database mongodb setup to new file: contrail:profile:mongodb

Patch 3:
- Configured all remaining files except keystone (bug) and pipeline.yaml

Patch 4:
- Mongo DB Replset configured and setup
- Ceilometer Pipeline.yaml has been templated
- Keystone notification driver change needs Rabbit MQ to be provisioned before Keystone
- Have filed separate bug for above

Patch 5:
- Implemented review comments
- Final commit
- Tested on non-HA with/without Ceilometer + HA without Ceilometer

Change-Id: I321305ee1140546ebea8a818ca5bfba426e0c21d
  • Loading branch information
nitishkrishna committed Jun 8, 2015
1 parent 9cbb8c6 commit a72aa34
Show file tree
Hide file tree
Showing 16 changed files with 416 additions and 64 deletions.
Expand Up @@ -51,7 +51,10 @@
Nova_config<| |> {
before +> File_line_after[
'nova-notification-driver-common',
'nova-notification-driver-ceilometer'
'nova-notification-driver-ceilometer',
'nova-notify-on-state-change',
'nova-instance-usage-audit',
'nova-instance-usage-audit-period'
],
}

Expand All @@ -67,6 +70,21 @@
path => '/etc/nova/nova.conf',
after => '^\s*\[DEFAULT\]',
notify => Service['nova-compute'];
'nova-notify-on-state-change':
line => 'notify_on_state_change=vm_and_task_state',
path => '/etc/nova/nova.conf',
after => '^\s*\[DEFAULT\]',
notify => Service['nova-compute'];
'nova-instance-usage-audit':
line => 'instance_usage_audit=True',
path => '/etc/nova/nova.conf',
after => '^\s*\[DEFAULT\]',
notify => Service['nova-compute'];
'nova-instance-usage-audit-period':
line => 'instance_usage_audit_period=hour',
path => '/etc/nova/nova.conf',
after => '^\s*\[DEFAULT\]',
notify => Service['nova-compute'];
}

}
12 changes: 11 additions & 1 deletion contrail/environment/modules/ceilometer/manifests/init.pp
Expand Up @@ -54,6 +54,9 @@
# Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be
# available on some distributions.
# Defaults to 'SSLv3'
# [*auth_strategy*]
# Ceilometer authentication strategy
# Defaults to 'keystone'
#
# [*qpid_hostname*]
# [*qpid_port*]
Expand Down Expand Up @@ -104,7 +107,8 @@
$qpid_reconnect_limit = 0,
$qpid_reconnect_interval_min = 0,
$qpid_reconnect_interval_max = 0,
$qpid_reconnect_interval = 0
$qpid_reconnect_interval = 0,
$auth_strategy = 'keystone'
) {

validate_string($metering_secret)
Expand Down Expand Up @@ -278,4 +282,10 @@
}
}

if $auth_strategy {
ceilometer_config {
'DEFAULT/auth_strategy' : value => $auth_strategy;
}
}

}
@@ -0,0 +1,93 @@
---
sources:
- name: meter_source
interval: 600
meters:
- "*"
sinks:
- meter_sink
- name: cpu_source
interval: 600
meters:
- "cpu"
sinks:
- cpu_sink
- name: disk_source
interval: 600
meters:
- "disk.read.bytes"
- "disk.read.requests"
- "disk.write.bytes"
- "disk.write.requests"
sinks:
- disk_sink
- name: network_source
interval: 600
meters:
- "network.incoming.bytes"
- "network.incoming.packets"
- "network.outgoing.bytes"
- "network.outgoing.packets"
sinks:
- network_sink
- name: contrail_source
interval: 600
meters:
- "ip.floating.receive.packets"
- "ip.floating.transmit.packets"
- "ip.floating.receive.bytes"
- "ip.floating.transmit.bytes"
resources:
- contrail://<%= @analytics_node_ip %>:8081
sinks:
- contrail_sink
sinks:
- name: meter_sink
transformers:
publishers:
- notifier://
- name: cpu_sink
transformers:
- name: "rate_of_change"
parameters:
target:
name: "cpu_util"
unit: "%"
type: "gauge"
scale: "100.0 / (10**9 * (resource_metadata.cpu_number or 1))"
publishers:
- notifier://
- name: disk_sink
transformers:
- name: "rate_of_change"
parameters:
source:
map_from:
name: "disk\\.(read|write)\\.(bytes|requests)"
unit: "(B|request)"
target:
map_to:
name: "disk.\\1.\\2.rate"
unit: "\\1/s"
type: "gauge"
publishers:
- notifier://
- name: network_sink
transformers:
- name: "rate_of_change"
parameters:
source:
map_from:
name: "network\\.(incoming|outgoing)\\.(bytes|packets)"
unit: "(B|packet)"
target:
map_to:
name: "network.\\1.\\2.rate"
unit: "\\1/s"
type: "gauge"
publishers:
- notifier://
- name: contrail_sink
publishers:
- rpc://
transformers:
@@ -0,0 +1,23 @@
# == Class: contrail::ceilometer::agent::auth
# The puppet module to set up contrail::profile::openstack::ceilometer agent authentication parameters
#
#
class contrail::ceilometer::agent::auth {

# Using hiera function as inheriting contrail::config failed
$controller_address_management = hiera(openstack::controller::address::management)
$ceilometer_password = hiera(openstack::ceilometer::password)

$auth_url = "http://${controller_address_management}:5000/v2.0"
$auth_password = $ceilometer_password
$auth_tenant_name = "service"
$auth_username = "ceilometer"

class { '::ceilometer::agent::auth':
auth_url => $auth_url,
auth_password => $auth_password,
auth_tenant_name => $auth_tenant_name,
auth_user => $auth_username,
}
notify { "contrail::ceilometer::agent::auth - auth_url = $::ceilometer::agent::auth::auth_url":; }
}
Expand Up @@ -56,6 +56,10 @@
# Values are true, false or on_failure
# (optional) - Defaults to false
#
# [*enable_ceilometer*]
# Flag to include or exclude ceilometer service as part of openstack module dynamically.
# (optional) - Defaults to false.
#
class contrail::contrail_openstack (
$openstack_ip = $::contrail::params::openstack_ip_list[0],
$keystone_ip = $::contrail::params::keystone_ip,
Expand All @@ -69,6 +73,7 @@
$keystone_auth_protocol = $::contrail::params::keystone_auth_protocol,
$contrail_logoutput = $::contrail::params::contrail_logoutput,
$host_control_ip = $::contrail::params::host_ip,
$enable_ceilometer = $::contrail::params::enable_ceilometer,
) inherits ::contrail::params {
# Main code for class

Expand All @@ -82,11 +87,11 @@
}

if ($external_vip != "") {
$vnc_base_url_ip = $external_vip
$vnc_base_url_ip = $external_vip
} elsif ($internal_vip != "" ) {
$vnc_base_url_ip = $internal_vip
$vnc_base_url_ip = $internal_vip
} else {
$vnc_base_url_ip = $openstack_mgmt_ip
$vnc_base_url_ip = $openstack_mgmt_ip
}

# Create mysql token file.
Expand Down Expand Up @@ -147,5 +152,20 @@
provider => shell,
logoutput => $contrail_logoutput
}

if ($enable_ceilometer) {
# Set instance_usage_audit_period to hour
exec { "exec_set_instance_usage_audit_period":
command => "openstack-config --set /etc/nova/nova.conf DEFAULT instance_usage_audit_period hour && echo exec_set_instance_usage_audit_period >> /etc/contrail/contrail_openstack_exec.out",
provider => shell,
require => [ File["/etc/nova/nova.conf"] ],
logoutput => $contrail_logoutput
}
# Set instance_usage_audit_period to hour
exec { "exec_set_instance_usage_audit":
command => "openstack-config --set /etc/nova/nova.conf DEFAULT instance_usage_audit True && echo exec_set_instance_usage_audit >> /etc/contrail/contrail_openstack_exec.out",
provider => shell,
require => [ File["/etc/nova/nova.conf"] ],
logoutput => $contrail_logoutput
}
}
}
7 changes: 6 additions & 1 deletion contrail/environment/modules/contrail/manifests/params.pp
Expand Up @@ -512,6 +512,10 @@
# within puppet manifest is not used and we rely on sequencing to help with that.
# (optional) - Defaults to false.
#
# [*enable_ceilometer*]
# Flag to include or exclude ceilometer service as part of openstack module dynamically.
# (optional) - Defaults to false.
#
class contrail::params (
$host_ip,
$uuid,
Expand Down Expand Up @@ -640,7 +644,8 @@
$enable_pre_exec_vnc_galera = true,
$enable_post_exec_vnc_galera = true,
$enable_post_provision = true,
$enable_sequence_provisioning = false
$enable_sequence_provisioning = false,
$enable_ceilometer = false,
) {
# Manifests use keystone_admin_token to refer to keystone_service_token too. Hence set
# that varible here.
Expand Down
14 changes: 12 additions & 2 deletions contrail/environment/modules/contrail/manifests/profile/compute.pp
Expand Up @@ -7,14 +7,24 @@
# Flag to indicate if profile is enabled. If true, the module is invoked.
# (optional) - Defaults to true.
#
# [*enable_ceilometer*]
# Flag to include or exclude ceilometer service as part of openstack module dynamically.
# (optional) - Defaults to false.
#
class contrail::profile::compute (
$enable_module = $::contrail::params::enable_compute
$enable_module = $::contrail::params::enable_compute,
$enable_ceilometer = $::contrail::params::enable_ceilometer
) {
if ($enable_module) {
require ::contrail::common
require ::openstack::profile::firewall
require ::contrail::profile::nova::compute
# require ::openstack::profile::ceilometer::agent

if ($enable_ceilometer) {
include ::openstack::common::ceilometer
include ::contrail::ceilometer::agent::auth
include ::ceilometer::agent::compute
}
}
}

Expand Up @@ -7,10 +7,18 @@
# Flag to indicate if profile is enabled. If true, the module is invoked.
# (optional) - Defaults to true.
#
# [*enable_ceilometer*]
# Flag to include or exclude ceilometer service as part of openstack module dynamically.
# (optional) - Defaults to false.
#
class contrail::profile::database (
$enable_module = $::contrail::params::enable_database
$enable_module = $::contrail::params::enable_database,
$enable_ceilometer = $::contrail::params::enable_ceilometer
) {
if ($enable_module) {
contain ::contrail::database
if ($enable_ceilometer) {
include ::contrail::profile::mongodb
}
}
}

0 comments on commit a72aa34

Please sign in to comment.