Enable ceilometer-agent-compute on compute-vmware

- install and configure ceilometer-agent-compute on compute-vmware role
- ceilometer-agent-compute and initial setup is handled by
  'ceilometer-compute' deployment task
- ceilometers agent auth related settings (keystone) are not configured
  using ceilometer-keystone deployment task, because it requires to
  openstack client to be present, instead we use 'ceilometer_config'
  resource
- apply 'ceilometer-compute' task to 'compute-vmware' role in
  ceilometer/tasks.yaml
- align assignment operators to conform Puppet Style Guide

Closes-bug: #1521201
Change-Id: I23ef53a8fb959c1f5fb999da723672d9ca1de726
This commit is contained in:
Igor Zinovik 2015-11-30 16:17:05 +03:00
parent 46dde66afd
commit c403ba9878
10 changed files with 208 additions and 62 deletions

View File

@ -17,7 +17,7 @@
- id: ceilometer-compute - id: ceilometer-compute
type: puppet type: puppet
groups: [compute] groups: [compute, compute-vmware]
required_for: [deploy_end] required_for: [deploy_end]
requires: [ceilometer-controller, top-role-compute] requires: [ceilometer-controller, top-role-compute]
cross-depends: cross-depends:

View File

@ -1,7 +1,6 @@
notice('MODULAR: vmware/compute-vmware.pp') notice('MODULAR: vmware/compute-vmware.pp')
$debug = hiera('debug', true) $debug = hiera('debug', true)
$ceilometer_hash = hiera('ceilometer',{})
$vcenter_hash = hiera('vcenter', {}) $vcenter_hash = hiera('vcenter', {})
$computes_hash = parse_vcenter_settings($vcenter_hash['computes']) $computes_hash = parse_vcenter_settings($vcenter_hash['computes'])
@ -11,6 +10,41 @@ $node_name = "node-$uid"
$defaults = { $defaults = {
current_node => $node_name, current_node => $node_name,
vlan_interface => $vcenter_hash['esxi_vlan_interface'] vlan_interface => $vcenter_hash['esxi_vlan_interface']
} }
create_resources(vmware::compute_vmware, $computes_hash, $defaults) create_resources(vmware::compute_vmware, $computes_hash, $defaults)
$ceilometer_hash = hiera('ceilometer', {})
$ceilometer_enabled = $ceilometer_hash['enabled']
if $ceilometer_enabled {
$computes = $vcenter_hash['computes']
$compute = $computes[0]
$password = $ceilometer_hash['user_password']
$tenant = pick($ceilometer_hash['tenant'], 'services')
$service_endpoint = hiera('service_endpoint')
$management_vip = hiera('management_vip')
$ssl_hash = hiera_hash('use_ssl', {})
$auth_protocol = get_ssl_property($ssl_hash, {}, 'keystone', 'internal', 'protocol', 'http')
$auth_host = get_ssl_property($ssl_hash, {}, 'keystone', 'internal', 'hostname', [hiera('keystone_endpoint', ''), $service_endpoint, $management_vip])
$auth_port = '5000'
$identity_uri = "${auth_protocol}://${auth_host}:${auth_port}"
class { 'vmware::ceilometer::compute_vmware':
debug => $debug,
availability_zone_name => $compute['availability_zone_name'],
vc_cluster => $compute['vc_cluster'],
vc_host => $compute['vc_host'],
vc_user => $compute['vc_user'],
vc_password => $compute['vc_password'],
service_name => $compute['service_name'],
identity_uri => $identity_uri,
auth_user => 'ceilometer',
auth_password => $password,
tenant => $tenant,
}
}

View File

@ -28,7 +28,7 @@
type: puppet type: puppet
groups: [compute-vmware] groups: [compute-vmware]
required_for: [deploy_end] required_for: [deploy_end]
requires: [top-role-compute] requires: [top-role-compute, ceilometer-compute, ceilometer-keystone]
condition: "settings:common.use_vcenter.value == true" condition: "settings:common.use_vcenter.value == true"
parameters: parameters:
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/vmware/compute-vmware.pp puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/vmware/compute-vmware.pp

View File

@ -11,6 +11,7 @@ class vmware::ceilometer (
$debug = false, $debug = false,
) { ) {
# $default_log_levels gets used in template file. Do not remove.
if $debug { if $debug {
# Enable debug for rabbit and vmware only # Enable debug for rabbit and vmware only
$default_log_levels = 'amqp=DEBUG,amqplib=DEBUG,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,oslo.vmware=DEBUG' $default_log_levels = 'amqp=DEBUG,amqplib=DEBUG,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,oslo.vmware=DEBUG'
@ -23,8 +24,8 @@ class vmware::ceilometer (
include ceilometer::params include ceilometer::params
package { 'ceilometer-agent-compute': package { 'ceilometer-agent-compute':
name => $ceilometer::params::agent_compute_package_name, ensure => present,
ensure => present name => $::ceilometer::params::agent_compute_package_name,
} }
create_resources(vmware::ceilometer::ha, parse_vcenter_settings($vcenter_settings)) create_resources(vmware::ceilometer::ha, parse_vcenter_settings($vcenter_settings))

View File

@ -0,0 +1,81 @@
# == Class: vmware::ceilometer::compute_vmware
# Class configures ceilometer compute agent on compute-vmware node.
#
# It does the following:
# - configure keystone auth parameters
# - reload ceilometer compute agent service, package is already
# installed by ceilometer-compute deployment task
#
# === Parameters
# [*availability_zone_name*]
# (required) Availability zone name that will be used to form host parameter
# [*vc_cluster*]
# (required) vCenter cluster name that is going to be monitored
# [*vc_host*]
# (required) vCenter cluster name that is going to be monitored
# [*vc_user*]
# (required) vCenter user name to use
# [*vc_password*]
# (required) Password for above vCenter user
# [*service_name*]
# (required) Parameter to form 'host' parameter
# [*target_node*]
# (optional) Parameter that specifies on which node service will be placed
# [*datastore_regex*]
# (optional) Regex which match datastore that will be used for openstack vms
# [*debug*]
# (optional) Flag that turn debug logging
# [*identity_uri*]
# (optional) URL to access Keystone service
# [*auth_user*]
# (optional) Keystone user
# [*auth_password*]
# (optional) Keystone password
# [*tenant*]
# (optional) Admin tenant name
#
class vmware::ceilometer::compute_vmware(
$availability_zone_name,
$vc_cluster,
$vc_host,
$vc_user,
$vc_password,
$service_name,
$target_node = undef,
$datastore_regex = undef,
$debug = undef,
$identity_uri = undef,
$auth_user = undef,
$auth_password = undef,
$tenant = undef,
) {
if $debug {
# Enable debug for rabbit and vmware only
$default_log_levels = 'amqp=DEBUG,amqplib=DEBUG,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,oslo.vmware=DEBUG'
} else {
$default_log_levels = 'amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,oslo.vmware=WARN'
}
ceilometer_config {
'DEFAULT/default_log_levels': value => $default_log_levels;
'DEFAULT/hypervisor_inspector': value => 'vsphere';
'DEFAULT/host': value => "${availability_zone_name}-${service_name}";
'vmware/host_ip': value => $vc_host;
'vmware/host_username': value => $vc_user;
'vmware/host_password': value => $vc_password;
'keystone_authtoken/admin_user': value => $auth_user;
'keystone_authtoken/admin_password': value => $auth_password;
'keystone_authtoken/admin_tenant_name': value => $tenant;
'keystone_authtoken/identity_uri': value => $identity_uri;
}
include ceilometer::params
service { 'ceilometer-agent-compute':
ensure => running,
name => $::ceilometer::params::agent_compute_service_name,
}
Ceilometer_config<| |> ~> Service['ceilometer-agent-compute']
}

View File

@ -11,6 +11,7 @@ define vmware::ceilometer::ha (
$ceilometer_config = '/etc/ceilometer/ceilometer.conf', $ceilometer_config = '/etc/ceilometer/ceilometer.conf',
$ceilometer_conf_dir = '/etc/ceilometer/ceilometer-compute.d', $ceilometer_conf_dir = '/etc/ceilometer/ceilometer-compute.d',
) { ) {
if ($target_node == 'controllers') {
$ceilometer_compute_conf = "${ceilometer_conf_dir}/vmware-${availability_zone_name}_${service_name}.conf" $ceilometer_compute_conf = "${ceilometer_conf_dir}/vmware-${availability_zone_name}_${service_name}.conf"
if ! defined(File[$ceilometer_conf_dir]) { if ! defined(File[$ceilometer_conf_dir]) {
@ -67,4 +68,5 @@ define vmware::ceilometer::ha (
File["${ceilometer_compute_conf}"]-> File["${ceilometer_compute_conf}"]->
Cs_resource["p_ceilometer_agent_compute_vmware_${availability_zone_name}_${service_name}"]-> Cs_resource["p_ceilometer_agent_compute_vmware_${availability_zone_name}_${service_name}"]->
Service["p_ceilometer_agent_compute_vmware_${availability_zone_name}_${service_name}"] Service["p_ceilometer_agent_compute_vmware_${availability_zone_name}_${service_name}"]
}
} }

View File

@ -118,6 +118,7 @@ libvirt_type: qemu
puppet: puppet:
modules: rsync://10.109.5.2:/puppet/2015.1.0-8.0/modules/ modules: rsync://10.109.5.2:/puppet/2015.1.0-8.0/modules/
manifests: rsync://10.109.5.2:/puppet/2015.1.0-8.0/manifests/ manifests: rsync://10.109.5.2:/puppet/2015.1.0-8.0/manifests/
host_uuid: '00000000-0000-0000-0000-000000000000'
mysql: mysql:
root_password: 9aXGuMEH root_password: 9aXGuMEH
wsrep_password: O9DMNRw7 wsrep_password: O9DMNRw7
@ -219,10 +220,14 @@ network_metadata:
- compute-vmware - compute-vmware
name: node-2 name: node-2
vips: vips:
public_vrouter_vip: 10.109.6.3 vrouter_pub:
management_vip: 10.109.7.2 ipaddr: 10.109.6.3
public_vip: 10.109.6.2 management:
management_vrouter_vip: 10.109.7.3 ipaddr: 10.109.7.2
public:
ipaddr: 10.109.6.2
vrouter:
ipaddr: 10.109.7.3
openstack_version: 2015.1.0-8.0 openstack_version: 2015.1.0-8.0
public_vrouter_vip: 10.109.6.3 public_vrouter_vip: 10.109.6.3
kernel_params: kernel_params:

View File

@ -121,6 +121,7 @@ storage:
metadata: metadata:
weight: 60 weight: 60
label: Storage label: Storage
host_uuid: '00000000-0000-0000-0000-000000000000'
resume_guests_state_on_host_boot: true resume_guests_state_on_host_boot: true
public_vip: 10.109.6.2 public_vip: 10.109.6.2
syslog: syslog:

View File

@ -21,6 +21,16 @@ describe manifest do
end end
end end
ceilometer_enabled = Noop.hiera_structure('ceilometer/enabled')
if ceilometer_enabled == 'true'
it 'should have /etc/ceilometer/ceilometer.conf' do
should contain_file('/etc/ceilometer/ceilometer.conf').with_content(
%r{\n\s*hypervisor_inspector=vsphere\n}
)
end
end
end # end of shared_examples end # end of shared_examples
test_ubuntu_and_centos manifest test_ubuntu_and_centos manifest

View File

@ -57,6 +57,18 @@ class Noop
task = YAML.load_file(file) task = YAML.load_file(file)
@tasks += task if task.is_a? Array @tasks += task if task.is_a? Array
end end
@tasks.each do |group|
next unless group['type'] == 'group'
group_tasks = group.fetch 'tasks', []
group_tasks.each do |group_task|
@tasks.each do |task|
next unless task['id'] == group_task
next unless task['groups'].is_a? Array
next if task['groups'].include? group
task['groups'] << group['id']
end
end
end
@tasks @tasks
end end