Merge "Mend ceilometer_radosgw_user provider"

This commit is contained in:
Jenkins 2016-01-14 14:50:30 +00:00 committed by Gerrit Code Review
commit 4275cca847
22 changed files with 433 additions and 288 deletions

View File

@ -11,13 +11,13 @@ fixtures:
'firewall': 'https://github.com/puppetlabs/puppetlabs-firewall.git'
'openstacklib':
repo: 'https://review.fuel-infra.org/puppet-modules/puppet-openstacklib.git'
branch: '7.0.0-mos-rc4'
branch: '7.0.0-rc6'
'horizon':
repo: 'https://review.fuel-infra.org/puppet-modules/puppet-horizon.git'
branch: '7.0.0-mos-rc3'
'keystone':
repo: 'https://review.fuel-infra.org/puppet-modules/puppet-keystone.git'
branch: '7.0.0-mos-rc3'
branch: '7.0.0-rc4'
'neutron':
repo: 'https://review.fuel-infra.org/puppet-modules/puppet-neutron.git'
branch: '7.0.0-mos-rc4'
@ -32,10 +32,10 @@ fixtures:
branch: '7.0.0-mos-rc2'
'ceilometer':
repo: 'https://review.fuel-infra.org/puppet-modules/puppet-ceilometer.git'
branch: '7.0.0-mos-rc2'
branch: '7.0.0-rc3'
'cinder':
repo: 'https://review.fuel-infra.org/puppet-modules/openstack-cinder.git'
branch: '7.0.0-mos-rc2'
branch: '7.0.0-rc3'
'sahara':
repo: 'https://review.fuel-infra.org/puppet-modules/puppet-sahara.git'
branch: '7.0.0-mos-rc2'
@ -55,3 +55,6 @@ fixtures:
'corosync': "#{source_dir}/../corosync"
'pacemaker': "#{source_dir}/../pacemaker"
'haproxy': "#{source_dir}/../haproxy"
'ceilometer_ha': "#{source_dir}/../ceilometer_ha"
'pacemaker_wrappers': "#{source_dir}/../pacemaker_wrappers"
'mellanox_openstack': "#{source_dir}/../mellanox_openstack"

View File

@ -89,7 +89,7 @@ class openstack::ceilometer (
if ($on_controller) {
# Configure the ceilometer database
# Only needed if ceilometer::agent::central or ceilometer::api are declared
# Only needed if ceilometer::agent::polling or ceilometer::api are declared
if ( !$ext_mongo ) {
if ( $db_type == 'mysql' ) {
@ -114,7 +114,7 @@ class openstack::ceilometer (
}
ceilometer_config { 'service_credentials/os_endpoint_type': value => $os_endpoint_type} ->
Service<| title == 'ceilometer-agent-central'|>
Service<| title == 'ceilometer-polling'|>
class { '::ceilometer::db':
database_connection => $current_database_connection,
@ -147,8 +147,6 @@ class openstack::ceilometer (
collector_workers => $collector_workers,
}
class { '::ceilometer::agent::central': }
class { '::ceilometer::alarm::evaluator':
evaluation_interval => 60,
}
@ -162,13 +160,13 @@ class openstack::ceilometer (
if $ha_mode {
include ceilometer_ha::agent::central
Package[$::ceilometer::params::common_package_name] -> Class['::ceilometer_ha::agent::central']
Package[$::ceilometer::params::agent_central_package_name] -> Class['::ceilometer_ha::agent::central']
Service['ceilometer-polling'] -> Class['::ceilometer_ha::agent::central']
}
else {
Package[$::ceilometer::params::common_package_name] -> Service[$::ceilometer::params::agent_central_service_name]
Package[$::ceilometer::params::agent_central_package_name] -> Service[$::ceilometer::params::agent_central_service_name]
class { '::ceilometer::agent::polling':
enabled => !$ha_mode,
compute_namespace => false,
ipmi_namespace => false
}
}
@ -217,11 +215,13 @@ class openstack::ceilometer (
}
}
}
# Install compute agent
class { 'ceilometer::agent::compute':
enabled => true,
# Install polling agent
class { '::ceilometer::agent::polling':
central_namespace => false,
ipmi_namespace => false
}
ceilometer_config { 'service_credentials/os_endpoint_type': value => $os_endpoint_type} ->
Service<| title == 'ceilometer-agent-compute'|>
Service<| title == 'ceilometer-polling'|>
}
}

View File

@ -3,7 +3,7 @@
# [*syslog_log_facility*] Facility for syslog, if used. Optional. Note: duplicating conf option
# wouldn't have been used, but more powerfull rsyslog features managed via conf template instead
# [*ceilometer*] true if we use ceilometer
# [*notification_driver*] The driver(s) name to handle notifications. Defaults to undef.
class openstack::cinder(
$sql_connection,
@ -42,7 +42,7 @@ class openstack::cinder(
$identity_uri = false,
$keystone_user = 'cinder',
$region = 'RegionOne',
$ceilometer = false,
$notification_driver = undef,
$service_workers = $::processorcount,
$vmware_host_ip = '10.10.10.10',
$vmware_host_username = 'administrator@vsphere.local',
@ -266,9 +266,9 @@ class openstack::cinder(
}
}
if $ceilometer {
if $notification_driver {
class { 'cinder::ceilometer':
notification_driver => 'messagingv2'
notification_driver => $notification_driver
}
}
}

View File

@ -135,7 +135,7 @@ class openstack::compute (
$cinder_rate_limits = undef,
$create_networks = false,
$state_path = '/var/lib/nova',
$ceilometer = false,
$notification_driver = 'noop',
$ceilometer_metering_secret = 'ceilometer',
$libvirt_vif_driver = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver',
$storage_hash = {},
@ -267,6 +267,7 @@ class openstack::compute (
report_interval => $nova_report_interval,
service_down_time => $nova_service_down_time,
notify_on_state_change => $notify_on_state_change,
notification_driver => $notification_driver,
memcached_servers => $memcached_addresses,
}
@ -311,10 +312,8 @@ class openstack::compute (
nova_config {
'libvirt/live_migration_flag': value => 'VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST';
'libvirt/block_migration_flag': value => 'VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_NON_SHARED_INC';
}
nova_config {
'cinder/catalog_info': value => pick($nova_hash['cinder_catalog_info'], 'volume:cinder:internalURL')
'cinder/catalog_info': value => pick($nova_hash['cinder_catalog_info'], 'volume:cinder:internalURL');
'DEFAULT/connection_type': value => 'libvirt';
}
if $use_syslog {
@ -456,10 +455,6 @@ on packages update": }
}
}
nova_config {
'DEFAULT/connection_type': value => 'libvirt';
}
Package<| title == 'nova-compute'|> ~> Service<| title == 'nova-compute'|>
if !defined(Service['nova-compute']) {
notify{ "Module ${module_name} cannot notify service nova-compute\

View File

@ -93,7 +93,7 @@ class openstack::controller (
$nova_user_tenant = 'services',
$nova_hash = {},
# Required Ceilometer
$ceilometer = false,
$ceilometer_notification_driver = false,
$ceilometer_db_password = 'ceilometer_pass',
$ceilometer_user_password = 'ceilometer_pass',
$ceilometer_db_user = 'ceilometer',
@ -257,80 +257,80 @@ class openstack::controller (
class { 'openstack::nova::controller':
# Database
db_host => $db_host,
db_host => $db_host,
# Network
nameservers => $nameservers,
network_manager => $network_manager,
floating_range => $floating_range,
fixed_range => $fixed_range,
public_address => $public_address,
public_interface => $public_interface,
admin_address => $admin_address,
internal_address => $internal_address,
private_interface => $private_interface,
auto_assign_floating_ip => $auto_assign_floating_ip,
create_networks => $create_networks,
num_networks => $num_networks,
network_size => $network_size,
multi_host => $multi_host,
network_config => $network_config,
keystone_auth_uri => $keystone_auth_uri,
keystone_identity_uri => $keystone_identity_uri,
keystone_ec2_url => $keystone_ec2_url,
service_endpoint => $service_endpoint,
nameservers => $nameservers,
network_manager => $network_manager,
floating_range => $floating_range,
fixed_range => $fixed_range,
public_address => $public_address,
public_interface => $public_interface,
admin_address => $admin_address,
internal_address => $internal_address,
private_interface => $private_interface,
auto_assign_floating_ip => $auto_assign_floating_ip,
create_networks => $create_networks,
num_networks => $num_networks,
network_size => $network_size,
multi_host => $multi_host,
network_config => $network_config,
keystone_auth_uri => $keystone_auth_uri,
keystone_identity_uri => $keystone_identity_uri,
keystone_ec2_url => $keystone_ec2_url,
service_endpoint => $service_endpoint,
# Neutron
neutron => $network_provider ? {'nova' => false, 'neutron' => true},
segment_range => $segment_range,
tenant_network_type => $tenant_network_type,
neutron => $network_provider ? {'nova' => false, 'neutron' => true},
segment_range => $segment_range,
tenant_network_type => $tenant_network_type,
# Nova
nova_user => $nova_user,
nova_user_password => $nova_user_password,
nova_user_tenant => $nova_user_tenant,
nova_db_password => $nova_db_password,
nova_db_user => $nova_db_user,
nova_db_dbname => $nova_db_dbname,
nova_quota_driver => $nova_quota_driver,
nova_hash => $nova_hash,
nova_user => $nova_user,
nova_user_password => $nova_user_password,
nova_user_tenant => $nova_user_tenant,
nova_db_password => $nova_db_password,
nova_db_user => $nova_db_user,
nova_db_dbname => $nova_db_dbname,
nova_quota_driver => $nova_quota_driver,
nova_hash => $nova_hash,
# RPC
queue_provider => $queue_provider,
amqp_hosts => $amqp_hosts,
amqp_user => $amqp_user,
amqp_password => $amqp_password,
rabbit_ha_queues => $rabbit_ha_queues,
rabbitmq_bind_ip_address => $rabbitmq_bind_ip_address,
rabbitmq_bind_port => $rabbitmq_bind_port,
rabbitmq_cluster_nodes => $rabbitmq_cluster_nodes,
cache_server_ip => $cache_server_ip,
cache_server_port => $cache_server_port,
queue_provider => $queue_provider,
amqp_hosts => $amqp_hosts,
amqp_user => $amqp_user,
amqp_password => $amqp_password,
rabbit_ha_queues => $rabbit_ha_queues,
rabbitmq_bind_ip_address => $rabbitmq_bind_ip_address,
rabbitmq_bind_port => $rabbitmq_bind_port,
rabbitmq_cluster_nodes => $rabbitmq_cluster_nodes,
cache_server_ip => $cache_server_ip,
cache_server_port => $cache_server_port,
# Glance
glance_api_servers => $glance_api_servers,
glance_api_servers => $glance_api_servers,
# General
verbose => $verbose,
primary_controller => $primary_controller,
debug => $debug,
default_log_levels => $default_log_levels,
enabled => $enabled,
exported_resources => $export_resources,
enabled_apis => $enabled_apis,
api_bind_address => $api_bind_address,
ensure_package => $::openstack_version['nova'],
use_stderr => $use_stderr,
use_syslog => $use_syslog,
syslog_log_facility => $syslog_log_facility_nova,
syslog_log_facility_neutron => $syslog_log_facility_neutron,
nova_rate_limits => $nova_rate_limits,
nova_report_interval => $nova_report_interval,
nova_service_down_time => $nova_service_down_time,
cinder => $cinder,
service_workers => $service_workers,
verbose => $verbose,
primary_controller => $primary_controller,
debug => $debug,
default_log_levels => $default_log_levels,
enabled => $enabled,
exported_resources => $export_resources,
enabled_apis => $enabled_apis,
api_bind_address => $api_bind_address,
ensure_package => $::openstack_version['nova'],
use_stderr => $use_stderr,
use_syslog => $use_syslog,
syslog_log_facility => $syslog_log_facility_nova,
syslog_log_facility_neutron => $syslog_log_facility_neutron,
nova_rate_limits => $nova_rate_limits,
nova_report_interval => $nova_report_interval,
nova_service_down_time => $nova_service_down_time,
cinder => $cinder,
service_workers => $service_workers,
# SQLAlchemy backend
max_retries => $max_retries,
max_pool_size => $max_pool_size,
max_overflow => $max_overflow,
idle_timeout => $idle_timeout,
novnc_address => $novnc_address,
ha_mode => $ha_mode,
ceilometer => $ceilometer,
max_retries => $max_retries,
max_pool_size => $max_pool_size,
max_overflow => $max_overflow,
idle_timeout => $idle_timeout,
novnc_address => $novnc_address,
ha_mode => $ha_mode,
ceilometer_notification_driver => $ceilometer_notification_driver,
neutron_metadata_proxy_shared_secret => $network_provider ? {'nova'=>undef, 'neutron'=>$neutron_metadata_proxy_secret },
}

View File

@ -93,7 +93,7 @@ class openstack::glance (
$rbd_store_user = 'images',
$rbd_store_pool = 'images',
$rados_connect_timeout = '0',
$ceilometer = false,
$notification_driver = undef,
$service_workers = $::processorcount,
) {
validate_string($glance_user_password)
@ -220,14 +220,6 @@ class openstack::glance (
$rabbit_hosts_real = $rabbit_hosts
}
# Configure rabbitmq notifications
# TODO(bogdando) sync qpid support from upstream
if $ceilometer {
$notification_driver = 'messaging'
} else {
$notification_driver = 'noop'
}
class { 'glance::notify::rabbitmq':
rabbit_password => $rabbit_password,
rabbit_userid => $rabbit_userid,

View File

@ -80,7 +80,7 @@ class openstack::keystone (
$cache_backend = 'keystone.cache.memcache_pool',
$token_provider = undef,
$revoke_driver = false,
$ceilometer = false,
$notification_driver = undef,
$service_workers = $::processorcount,
$fernet_src_repository = undef,
$fernet_key_repository = '/etc/keystone/fernet-keys',
@ -106,14 +106,6 @@ class openstack::keystone (
$admin_real = $internal_real
}
if $ceilometer {
$notification_driver = 'messagingv2'
$notification_topics = 'notifications'
} else {
$notification_driver = false
$notification_topics = false
}
if $memcache_servers {
$memcache_servers_real = suffix($memcache_servers, inline_template(':<%= @memcache_server_port %>'))
$token_driver = 'keystone.token.persistence.backends.memcache_pool.Token'
@ -162,7 +154,6 @@ class openstack::keystone (
token_driver => $token_driver,
token_provider => $token_provider,
notification_driver => $notification_driver,
notification_topics => $notification_topics,
token_caching => $token_caching,
cache_backend => $cache_backend,
revoke_driver => $revoke_driver,

View File

@ -31,81 +31,81 @@ class openstack::nova::controller (
# Nova Required
$nova_user_password,
$nova_db_password,
$nova_hash = {},
$primary_controller = false,
$ha_mode = false,
$nova_hash = {},
$primary_controller = false,
$ha_mode = false,
# Network
$fixed_range = '10.0.0.0/24',
$floating_range = false,
$fixed_range = '10.0.0.0/24',
$floating_range = false,
$internal_address,
$admin_address,
$service_endpoint = '127.0.0.1',
$auto_assign_floating_ip = false,
$create_networks = true,
$num_networks = 1,
$network_size = 255,
$multi_host = false,
$network_config = {},
$network_manager = 'nova.network.manager.FlatDHCPManager',
$nova_quota_driver = 'nova.quota.NoopQuotaDriver',
$service_endpoint = '127.0.0.1',
$auto_assign_floating_ip = false,
$create_networks = true,
$num_networks = 1,
$network_size = 255,
$multi_host = false,
$network_config = {},
$network_manager = 'nova.network.manager.FlatDHCPManager',
$nova_quota_driver = 'nova.quota.NoopQuotaDriver',
# Neutron
$neutron = false,
$segment_range = '1:4094',
$tenant_network_type = 'gre',
$neutron = false,
$segment_range = '1:4094',
$tenant_network_type = 'gre',
# Nova
$nova_user = 'nova',
$nova_user_tenant = 'services',
$nova_db_user = 'nova',
$nova_db_dbname = 'nova',
$nova_user = 'nova',
$nova_user_tenant = 'services',
$nova_db_user = 'nova',
$nova_db_dbname = 'nova',
# RPC
# FIXME(bogdando) replace queue_provider for rpc_backend once all modules synced with upstream
$rpc_backend = 'nova.openstack.common.rpc.impl_kombu',
$queue_provider = 'rabbitmq',
$amqp_hosts = ['127.0.0.1:5672'],
$amqp_user = 'nova',
$amqp_password = 'rabbit_pw',
$rabbit_ha_queues = false,
$rabbitmq_bind_ip_address = 'UNSET',
$rabbitmq_bind_port = '5672',
$rabbitmq_cluster_nodes = [],
$cluster_partition_handling = 'autoheal',
$rpc_backend = 'nova.openstack.common.rpc.impl_kombu',
$queue_provider = 'rabbitmq',
$amqp_hosts = ['127.0.0.1:5672'],
$amqp_user = 'nova',
$amqp_password = 'rabbit_pw',
$rabbit_ha_queues = false,
$rabbitmq_bind_ip_address = 'UNSET',
$rabbitmq_bind_port = '5672',
$rabbitmq_cluster_nodes = [],
$cluster_partition_handling = 'autoheal',
# Database
$db_type = 'mysql',
$db_type = 'mysql',
# Glance
$glance_api_servers = undef,
$glance_api_servers = undef,
# VNC
$vnc_enabled = true,
$vnc_enabled = true,
# General
$keystone_auth_uri = 'http://127.0.0.1:5000/',
$keystone_identity_uri = 'http://127.0.0.1:35357/',
$keystone_ec2_url = 'http://127.0.0.1:5000/v2.0/ec2tokens',
$cache_server_ip = ['127.0.0.1'],
$cache_server_port = '11211',
$verbose = false,
$debug = false,
$default_log_levels = undef,
$enabled = true,
$exported_resources = true,
$nameservers = undef,
$ensure_package = present,
$enabled_apis = 'ec2,osapi_compute',
$api_bind_address = '0.0.0.0',
$use_syslog = false,
$use_stderr = true,
$syslog_log_facility = 'LOG_LOCAL6',
$syslog_log_facility_neutron = 'LOG_LOCAL4',
$nova_rate_limits = undef,
$nova_report_interval = '10',
$nova_service_down_time = '60',
$cinder = true,
$ceilometer = false,
$service_workers = $::processorcount,
$keystone_auth_uri = 'http://127.0.0.1:5000/',
$keystone_identity_uri = 'http://127.0.0.1:35357/',
$keystone_ec2_url = 'http://127.0.0.1:5000/v2.0/ec2tokens',
$cache_server_ip = ['127.0.0.1'],
$cache_server_port = '11211',
$verbose = false,
$debug = false,
$default_log_levels = undef,
$enabled = true,
$exported_resources = true,
$nameservers = undef,
$ensure_package = present,
$enabled_apis = 'ec2,osapi_compute',
$api_bind_address = '0.0.0.0',
$use_syslog = false,
$use_stderr = true,
$syslog_log_facility = 'LOG_LOCAL6',
$syslog_log_facility_neutron = 'LOG_LOCAL4',
$nova_rate_limits = undef,
$nova_report_interval = '10',
$nova_service_down_time = '60',
$cinder = true,
$ceilometer_notification_driver = false,
$service_workers = $::processorcount,
# SQLAlchemy backend
$idle_timeout = '3600',
$max_pool_size = '10',
$max_overflow = '30',
$max_retries = '-1',
$novnc_address = '127.0.0.1',
$idle_timeout = '3600',
$max_pool_size = '10',
$max_overflow = '30',
$max_retries = '-1',
$novnc_address = '127.0.0.1',
$neutron_metadata_proxy_shared_secret = undef,
) {
@ -218,9 +218,9 @@ class openstack::nova::controller (
}
# From legacy ceilometer notifications for nova
if ($ceilometer) {
if ($ceilometer_notification_driver) {
$notify_on_state_change = 'vm_and_task_state'
$notification_driver = concat(['messaging'], $nova_notification_driver)
$notification_driver = concat([$ceilometer_notification_driver], $nova_notification_driver)
} else {
$notification_driver = $nova_notification_driver
}

View File

@ -0,0 +1,119 @@
require 'spec_helper'
describe 'openstack::ceilometer' do
shared_examples_for 'ceilometer services config' do
[true, false].each do |ha_mode|
context "on controller node with HA mode set to '#{ha_mode}'" do
let :params do
{
:on_controller => true,
:ha_mode => ha_mode,
}
end
it 'contains class ceilometer::agent::polling' do
is_expected.to contain_class('ceilometer::agent::polling').with(
:enabled => !ha_mode,
:compute_namespace => false,
:ipmi_namespace => false
)
end
if ha_mode
it { is_expected.to contain_class('ceilometer_ha::agent::central') }
end
end
end
context "on conroller node" do
let :params do
{
:on_controller => true,
:keystone_password => 'cEilomEtEr_pAss',
:keystone_user => 'ceilometer',
:keystone_tenant => 'services',
:keystone_region => 'Region007',
:keystone_protocol => 'http',
:keystone_host => '127.0.0.1',
:api_workers => facts[:processorcount],
:host => '10.254.0.9',
:port => '8777',
}
end
it { is_expected.to contain_class('ceilometer') }
it { is_expected.to contain_class('ceilometer::logging') }
it { is_expected.to contain_class('ceilometer::db') }
it { is_expected.to contain_class('ceilometer::expirer') }
it { is_expected.to contain_class('ceilometer::agent::notification') }
it { is_expected.to contain_class('ceilometer::alarm::evaluator') }
it { is_expected.to contain_class('ceilometer::collector') }
it { is_expected.to contain_class('ceilometer::alarm::notifier') }
it { is_expected.to contain_class('ceilometer::client') }
it { is_expected.to contain_class('ceilometer::agent::auth').with(
:auth_url => "#{params[:keystone_protocol]}://#{params[:keystone_host]}:5000/v2.0",
:auth_password => params[:keystone_password],
:auth_region => params[:keystone_region],
:auth_tenant_name => params[:keystone_tenant],
:auth_user => params[:keystone_user],
) }
it { is_expected.to contain_class('ceilometer::api').with(
:keystone_protocol => params[:keystone_protocol],
:keystone_host => params[:keystone_host],
:keystone_user => params[:keystone_user],
:keystone_password => params[:keystone_password],
:keystone_tenant => params[:keystone_tenant],
:host => params[:host],
:port => params[:port],
:api_workers => params[:api_workers],
) }
end
context "on compute node" do
let :params do
{
:on_compute => true,
}
end
it 'contains class ceilometer::agent::polling' do
is_expected.to contain_class('ceilometer::agent::polling').with(
:central_namespace => false,
:ipmi_namespace => false
)
end
end
end
context 'on Debian platforms' do
let :facts do
{
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:processorcount => 2,
:memorysize_mb => 4096,
}
end
it_configures 'ceilometer services config'
end
context 'on RedHat platforms' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:processorcount => 2,
:memorysize_mb => 4096,
}
end
it_configures 'ceilometer services config'
end
end

View File

@ -2,62 +2,74 @@ require 'spec_helper'
describe 'openstack::cinder' do
let(:default_params) do {
:sql_connection => 'mysql://user:pass@127.0.0.1/cinder',
:cinder_user_password => 'secret',
:glance_api_servers => 'http://127.0.0.1:9292',
let :default_params do
{
:sql_connection => 'sqlite:///relative/path/to/file.db',
:cinder_user_password => 'cindeRUserPAssw0rD',
:glance_api_servers => ['glance-001:9292', 'glance-002:9292'],
}
end
let(:params) do
default_params.merge(params)
end
shared_examples_for 'cinder configuration' do
let :p do
default_params.merge(params)
end
context 'with a default config' do
#let :params do {} end
it 'contains openstack::cinder' do
should contain_class('openstack::cinder')
let :params do
default_params
end
it 'contains cinder::glance' do
should contain_class('cinder::glance')
end
it 'configures with the default params' do
end
it { is_expected.to contain_class('cinder') }
it { is_expected.to contain_class('cinder::glance') }
it { is_expected.to contain_class('cinder::logging') }
it { is_expected.to contain_class('cinder::scheduler') }
end
context 'with keystone config' do
let :params do {
:identity_uri => 'http://192.168.0.1:5000',
}
end
let :p do
default_params.merge(params)
end
it 'contains keymgr keystone config' do
should contain_class('cinder::api').with(
:identity_uri => 'http://192.168.1.:5000',
:keymgr_encryption_auth_url => 'http://192.168.0.1:5000/v3',
context 'with custom config' do
let :params do
default_params.merge(
:bind_host => '156.151.59.35',
:identity_uri => 'http://192.168.0.1:5000',
:notification_driver => 'messagingv2',
:manage_volumes => true,
)
end
it 'contains cinder::glance' do
should contain_class('cinder::glance')
end
it { is_expected.to contain_class('cinder::volume') }
it 'configures with the default params' do
end
it { is_expected.to contain_class('cinder::api').with(
:bind_host => params[:bind_host],
:identity_uri => params[:identity_uri],
:keymgr_encryption_auth_url => "#{params[:identity_uri]}/v3",
) }
it { is_expected.to contain_class('cinder::ceilometer').with(
:notification_driver => params[:notification_driver],
) }
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian',
:operatingsystem => 'Debian',
:physicalprocessorcount => 2,
:memorysize_mb => 1024,
:openstack_version => { 'nova' => 'present' },
}
end
it_configures 'cinder configuration'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:physicalprocessorcount => 2,
:memorysize_mb => 1024,
:openstack_version => { 'nova' => 'present' },
}
end
it_configures 'cinder configuration'
end
end

View File

@ -10,10 +10,11 @@ Puppet::Type.type(:ceilometer_radosgw_user).provide(:user) do
INI_FILENAME = '/etc/ceilometer/ceilometer.conf'
def exists?
!(@property_hash[:ensure] == :absent or @property_hash.empty?)
radosgw_user_keys == access_keys_from_config
end
def create
create_radosgw_user unless radosgw_user_keys
set_access_keys
end
@ -30,13 +31,15 @@ Puppet::Type.type(:ceilometer_radosgw_user).provide(:user) do
['access_key', 'secret_key']
end
def radosgw_user_keys
@radosgw_user_keys ||= get_radosgw_user_keys
end
def set_access_keys
user_keys = get_user_keys
keys = get_access_keys_from_config
if ceilometer_file and user_keys != keys
if ceilometer_file
ceilometer_file.add_section(section, ini_filename) unless ceilometer_file.include?(section)
user_keys.keys.each do |key|
ceilometer_file[section][key] = user_keys[key]
radosgw_user_keys.keys.each do |key|
ceilometer_file[section][key] = radosgw_user_keys[key]
end
ceilometer_file.store
end
@ -55,8 +58,8 @@ Puppet::Type.type(:ceilometer_radosgw_user).provide(:user) do
end
end
def get_access_keys_from_config
keys = Hash.new
def access_keys_from_config
keys = {}
if ceilometer_file
key_settings.each do |setting|
keys[setting] = ceilometer_file[section][setting] if ceilometer_file[section] && ceilometer_file[section][setting]
@ -65,38 +68,37 @@ Puppet::Type.type(:ceilometer_radosgw_user).provide(:user) do
keys
end
def get_user_keys
def get_radosgw_user_keys
cmd = ['user', 'info', "--uid=#{@resource[:name]}"]
begin
hash_as_string = rgw_adm(cmd)
rescue Exception => e
if e.message =~ /could not fetch user info: no user info saved/
hash_as_string = create_radosgw_user
else
raise e
end
rgw_output = rgw_adm(cmd)
rescue Puppet::ExecutionFailure => e
return nil if e.message =~ /could not fetch user info: no user info saved/
raise e
end
hash = JSON.parse hash_as_string.to_s.gsub('=>', ':')
keys = {}
hash['keys'].each do |key|
if key['user'] == "#{@resource[:name]}"
keys['access_key'] = key['access_key']
keys['secret_key'] = key['secret_key']
end
end
keys
parse_radosgw_output(rgw_output)
end
def create_radosgw_user
cmd = ['user', 'create', "--uid=#{@resource[:name]}", "--display-name=#{@resource[:name]}"]
rgw_adm(cmd)
@resource[:caps].keys.each do |key|
@resource[:caps].each_key do |key|
cmd = ['caps', 'add', "--uid=#{@resource[:name]}", "--caps=#{key}=#{@resource[:caps][key]}"]
rgw_adm(cmd)
end
cmd = ['user', 'info', "--uid=#{@resource[:name]}"]
return rgw_adm(cmd)
end
def parse_radosgw_output(rgw_output)
keys = {}
rgw_keys = JSON.parse(rgw_output.to_s.gsub('=>', ':')).fetch('keys', {})
rgw_keys.each do |key|
if key['user'] == "#{@resource[:name]}"
keys['access_key'] = key['access_key']
keys['secret_key'] = key['secret_key']
end
end
keys
end
end

View File

@ -17,7 +17,7 @@ $syslog_log_facility = hiera('syslog_log_facility_glance')
$rabbit_hash = hiera_hash('rabbit_hash', {})
$max_pool_size = hiera('max_pool_size')
$max_overflow = hiera('max_overflow')
$ceilometer_hash = hiera_hash('ceilometer', {})
$ceilometer_hash = hiera_hash('ceilometer_hash', {})
$region = hiera('region','RegionOne')
$service_workers = pick($glance_hash['glance_workers'], min(max($::processorcount, 2), 16))
$ironic_hash = hiera_hash('ironic', {})
@ -130,7 +130,7 @@ class { 'openstack::glance':
rabbit_hosts => $rabbit_hosts,
rabbit_virtual_host => $rabbit_virtual_host,
known_stores => $glance_known_stores,
ceilometer => $ceilometer_hash[enabled],
notification_driver => $ceilometer_hash['notification_driver'],
service_workers => $service_workers,
rados_connect_timeout => $rados_connect_timeout,
}

View File

@ -71,7 +71,6 @@ $rabbit_hash = hiera_hash('rabbit', {})
$glance_hash = hiera_hash('glance', {})
$swift_hash = hiera('swift', {})
$cinder_hash = hiera_hash('cinder', {})
$ceilometer_hash = hiera('ceilometer',{})
$access_hash = hiera_hash('access', {})
# mp_hash is actually an array, not a hash
$mp_hash = hiera('mp', [])
@ -79,7 +78,6 @@ $keystone_hash = merge({'service_token_off' => $service_token_o
hiera_hash('keystone', {}))
$dns_nameservers = hiera('dns_nameservers', [])
$use_ceilometer = $ceilometer_hash['enabled']
$use_neutron = hiera('quantum', false)
$use_ovs = hiera('use_ovs', $use_neutron)
$verbose = true
@ -386,13 +384,18 @@ $sahara_roles = hiera('sahara_roles', ['primary-controller', 'controller'])
$sahara_nodes = get_nodes_hash_by_roles($network_metadata, $sahara_roles)
# Define ceilometer-releated parameters
$default_ceilometer_hash = {
$ceilometer = hiera('ceilometer', {})
$use_ceilometer = $ceilometer['enabled']
$ceilometer_defaults = {
'alarm_history_time_to_live' => '604800',
'event_time_to_live' => '604800',
'metering_time_to_live' => '604800',
'http_timeout' => '600'
'http_timeout' => '600',
'notification_driver' => $use_ceilometer ? { true => 'messagingv2', default => $::os_service_default },
}
$real_ceilometer_hash = merge($ceilometer_hash, $default_ceilometer_hash)
$real_ceilometer_hash = merge($ceilometer_defaults, $ceilometer)
# Define database-related variables:
# todo: use special node-roles instead controllers in the future

View File

@ -20,7 +20,7 @@ $service_endpoint = hiera('service_endpoint')
$glance_hash = hiera_hash('glance', {})
$nova_hash = hiera_hash('nova', {})
$cinder_hash = hiera_hash('cinder', {})
$ceilometer_hash = hiera_hash('ceilometer', {})
$ceilometer_hash = hiera_hash('ceilometer_hash', {})
$syslog_log_facility = hiera('syslog_log_facility_keystone')
$rabbit_hash = hiera_hash('rabbit_hash', {})
$neutron_user_password = hiera('neutron_user_password', false)
@ -139,7 +139,7 @@ class { 'openstack::keystone':
public_url => $public_url,
admin_url => $admin_url,
internal_url => $internal_url,
ceilometer => $ceilometer_hash['enabled'],
notification_driver => $ceilometer_hash['notification_driver'],
service_workers => $service_workers,
token_provider => $token_provider,
fernet_src_repository => '/var/lib/astute/keystone',

View File

@ -100,7 +100,7 @@ class {'openstack::cinder':
max_pool_size => $max_pool_size,
max_overflow => $max_overflow,
idle_timeout => $idle_timeout,
ceilometer => $ceilometer_hash[enabled],
notification_driver => $ceilometer_hash['notification_driver'],
service_workers => $service_workers,
} # end class

View File

@ -29,7 +29,7 @@ $nova_hash = hiera_hash('nova', {})
$nova_config_hash = hiera_hash('nova_config', {})
$api_bind_address = get_network_role_property('nova/api', 'ipaddr')
$rabbit_hash = hiera_hash('rabbit_hash', {})
$ceilometer_hash = hiera_hash('ceilometer',{})
$ceilometer_hash = hiera_hash('ceilometer_hash',{})
$syslog_log_facility_ceph = hiera('syslog_log_facility_ceph','LOG_LOCAL0')
$workloads_hash = hiera_hash('workloads_collector', {})
$service_endpoint = hiera('service_endpoint')
@ -149,7 +149,7 @@ class { '::openstack::controller':
service_endpoint => $service_endpoint,
neutron_metadata_proxy_secret => $neutron_metadata_proxy_secret,
cinder => true,
ceilometer => $ceilometer_hash[enabled],
ceilometer_notification_driver => $ceilometer_hash['notification_driver'],
service_workers => $service_workers,
use_syslog => $use_syslog,
use_stderr => $use_stderr,

View File

@ -14,7 +14,7 @@ if $use_neutron {
]
$rabbit_hash = hiera_hash('rabbit_hash', { })
$ceilometer_hash = hiera_hash('ceilometer', { })
$ceilometer_hash = hiera_hash('ceilometer_hash', { })
$network_scheme = hiera_hash('network_scheme')
$verbose = pick($openstack_network_hash['verbose'], hiera('verbose', true))
@ -27,7 +27,6 @@ if $use_neutron {
$bind_host = get_network_role_property('neutron/api', 'ipaddr')
$base_mac = $neutron_config['L2']['base_mac']
$use_ceilometer = $ceilometer_hash['enabled']
$amqp_hosts = split(hiera('amqp_hosts', ''), ',')
$amqp_user = $rabbit_hash['user']
$amqp_password = $rabbit_hash['password']
@ -99,8 +98,8 @@ if $use_neutron {
neutron_config { 'DEFAULT/use_syslog_rfc_format': value => true; }
}
if $use_ceilometer {
neutron_config { 'DEFAULT/notification_driver': value => 'messaging' }
neutron_config {
'DEFAULT/notification_driver': value => $ceilometer_hash['notification_driver'];
}
}

View File

@ -299,7 +299,7 @@ class { 'openstack::cinder':
max_pool_size => $max_pool_size,
max_overflow => $max_overflow,
idle_timeout => $idle_timeout,
ceilometer => $ceilometer_hash[enabled],
notification_driver => $ceilometer_hash['notification_driver'],
vmware_host_ip => $vcenter_hash['host_ip'],
vmware_host_username => $vcenter_hash['vc_user'],
vmware_host_password => $vcenter_hash['vc_password'],

View File

@ -278,7 +278,7 @@ class { 'openstack::compute':
cinder_iscsi_bind_addr => get_network_role_property('cinder/iscsi', 'ipaddr'),
cinder_user_password => $cinder_hash[user_password],
cinder_db_password => $cinder_hash[db_password],
ceilometer => $ceilometer_hash[enabled],
notification_driver => $ceilometer_hash['notification_driver'],
ceilometer_metering_secret => $ceilometer_hash[metering_secret],
ceilometer_user_password => $ceilometer_hash[user_password],
db_host => $db_host,

View File

@ -12,6 +12,25 @@ describe provider_class do
}
end
let :keys do
{
'access_key' => 'accEss',
'secret_key' => 'sEcrEt'
}
end
let :rgw_output do
{
'keys' => [
{ 'user' => 'ceilometer' }.merge(keys)
]
}
end
let :cmd do
['user', 'info', "--uid=#{user_attrs[:name]}"]
end
let :resource do
Puppet::Type::Ceilometer_radosgw_user.new(user_attrs)
end
@ -21,6 +40,10 @@ describe provider_class do
end
it 'checks that resource does not exist' do
provider.class.stubs(:rgw_adm)
.with(cmd)
.raises(Puppet::ExecutionFailure, 'could not fetch user info: no user info saved')
expect(provider.exists?).to eq false
end
@ -29,21 +52,16 @@ describe provider_class do
end
it 'gets access keys from config' do
keys = {'access_key' => 'accEss', 'secret_key' => 'sEcrEt'}
mock = {'rgw_admin_credentials' => keys}
File.expects(:exists?).with('/etc/ceilometer/ceilometer.conf').returns(true)
Puppet::Util::IniConfig::File.expects(:new).returns(mock)
mock.expects(:read).with('/etc/ceilometer/ceilometer.conf')
expect(provider.get_access_keys_from_config).to eq(keys)
expect(provider.access_keys_from_config).to eq(keys)
end
it 'gets user keys' do
keys = {'access_key' => 'accEss', 'secret_key' => 'sEcrEt'}
rgw_output = {'keys' => [{'user' => 'ceilometer'}.merge(keys)]}
cmd = ['user', 'info', "--uid=ceilometer"]
it 'gets radosgw user keys' do
provider.class.stubs(:rgw_adm).with(cmd).returns(rgw_output)
expect(provider.get_user_keys).to eq(keys)
expect(provider.radosgw_user_keys).to eq(keys)
end
end

View File

@ -69,7 +69,7 @@ describe manifest do
revoke_driver = 'keystone.contrib.revoke.backends.sql.Revoke'
database_idle_timeout = '3600'
ceilometer_hash = Noop.hiera_structure 'ceilometer'
ceilometer_hash = Noop.hiera 'ceilometer_hash', { 'enabled' => false }
token_provider = Noop.hiera('token_provider')
primary_controller = Noop.hiera 'primary_controller'
@ -214,11 +214,11 @@ describe manifest do
end
end
if ceilometer_hash and ceilometer_hash['enabled']
it 'should configure notification driver' do
should contain_keystone_config('DEFAULT/notification_driver').with(:value => 'messagingv2')
end
end
if ceilometer_hash['enabled']
it 'should configure notification driver' do
should contain_keystone_config('DEFAULT/notification_driver').with(:value => ceilometer_hash['notification_driver'])
end
end
if token_provider == 'keystone.token.providers.fernet.Provider'
it 'should check existence of /etc/keystone/fernet-keys directory' do

View File

@ -6,6 +6,7 @@ describe manifest do
shared_examples 'catalog' do
storage_hash = Noop.hiera 'storage_hash'
ceilometer_hash = Noop.hiera 'ceilometer_hash', { 'enabled' => false }
if Noop.hiera 'use_ceph' and !(storage_hash['volumes_lvm']) and !(member($roles, 'cinder-vmware'))
it { should contain_class('ceph') }
@ -63,6 +64,16 @@ describe manifest do
end
end
let :ceilometer_hash do
Noop.hiera 'ceilometer_hash', { 'enabled' => false }
end
if ceilometer_hash['enabled']
it 'should contain notification_driver option' do
should contain_cinder_config('DEFAULT/notification_driver').with(:value => ceilometer_hash['notification_driver'])
end
end
end
test_ubuntu_and_centos manifest
end