Add python-rados package in ceph backend class.
The python-rados package provides the functionality that was missing, which cradox implemented. As of ceph jewel there is an official package that replaces the need for the cradox package. The cradox package has been deprecated in favor of the offical package. Change-Id: I5dbc12b320c3b08e2a5c37ea91101252a2b5d823
This commit is contained in:
parent
a403dbca8e
commit
bbd0b178f4
|
@ -20,6 +20,7 @@ class gnocchi::params {
|
|||
$gnocchi_wsgi_script_source = '/usr/lib/python2.7/site-packages/gnocchi/rest/app.wsgi'
|
||||
$pymysql_package_name = undef
|
||||
$cradox_package_name = 'python2-cradox'
|
||||
$rados_package_name = 'python-rados'
|
||||
}
|
||||
'Debian': {
|
||||
$sqlite_package_name = 'python-pysqlite2'
|
||||
|
@ -37,6 +38,7 @@ class gnocchi::params {
|
|||
$gnocchi_wsgi_script_source = '/usr/share/gnocchi-common/app.wsgi'
|
||||
$pymysql_package_name = 'python-pymysql'
|
||||
$cradox_package_name = undef
|
||||
$rados_package_name = 'python-rados'
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported osfamily: ${::osfamily} operatingsystem")
|
||||
|
|
|
@ -42,7 +42,16 @@
|
|||
#
|
||||
# [*manage_cradox*]
|
||||
# (optional) Ensure state of the cradox package.
|
||||
# Defaults to True.
|
||||
# As of ceph jewel the python-rados package should be used. Option
|
||||
# must be set to false for Ubuntu as there is no cradox package for
|
||||
# Ubuntu.
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*manage_rados*]
|
||||
# (optional) Ensure state of the rados python package.
|
||||
# This option must be set to true for Ubuntu as there is no cradox
|
||||
# package available for Ubuntu.
|
||||
# Defaults to false.
|
||||
#
|
||||
class gnocchi::storage::ceph(
|
||||
$ceph_username,
|
||||
|
@ -51,12 +60,23 @@ class gnocchi::storage::ceph(
|
|||
$ceph_pool = 'gnocchi',
|
||||
$ceph_conffile = '/etc/ceph/ceph.conf',
|
||||
$manage_cradox = true,
|
||||
$manage_rados = false,
|
||||
) inherits gnocchi::params {
|
||||
|
||||
if (is_service_default($ceph_keyring) and is_service_default($ceph_secret)) or (! $ceph_keyring and ! $ceph_secret) {
|
||||
fail('You need to specify either gnocchi::storage::ceph::ceph_keyring or gnocchi::storage::ceph::ceph_secret.')
|
||||
}
|
||||
|
||||
if $manage_rados and $manage_cradox {
|
||||
fail('gnocchi::storage::ceph::manage_rados and gnocchi::storage::ceph::manage_cradox both cannot be set to true.')
|
||||
}
|
||||
|
||||
if $manage_cradox {
|
||||
if $::osfamily == 'Debian' {
|
||||
fail('gnocchi::storage::ceph::manage_cradox set to true on debian family will fail due to no package being available.')
|
||||
}
|
||||
}
|
||||
|
||||
gnocchi_config {
|
||||
'storage/driver': value => 'ceph';
|
||||
'storage/ceph_username': value => $ceph_username;
|
||||
|
@ -75,4 +95,14 @@ class gnocchi::storage::ceph(
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
if $manage_rados {
|
||||
if $::gnocchi::params::common_package_name {
|
||||
ensure_packages('python-rados', {
|
||||
'ensure' => 'present',
|
||||
'name' => $::gnocchi::params::rados_package_name,
|
||||
'tag' => ['openstack','gnocchi-package'],
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
features:
|
||||
- The python-rados package is part of ceph jewel release and should replace the cradox package.
|
||||
- Ubuntu Xenial comes with ceph jewel release and the python-rados package resolves a missing dependency for ceph backends.
|
||||
deprecations:
|
||||
- The cradox package setting in gnocchi::storage::ceph has been deprecated.
|
|
@ -9,6 +9,8 @@ describe 'gnocchi::storage::ceph' do
|
|||
{
|
||||
:ceph_username => 'joe',
|
||||
:ceph_keyring => 'client.admin',
|
||||
:manage_cradox => false,
|
||||
:manage_rados => true,
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -46,6 +48,60 @@ describe 'gnocchi::storage::ceph' do
|
|||
end
|
||||
it { expect { is_expected.to raise_error(Puppet::Error) } }
|
||||
end
|
||||
|
||||
context 'with manage_rados to true' do
|
||||
before do
|
||||
params.merge!({
|
||||
:manage_cradox => false,
|
||||
:manage_rados => true,
|
||||
})
|
||||
end
|
||||
|
||||
it { is_expected.not_to contain_package('python-cradox') }
|
||||
it { is_expected.to contain_package('python-rados').with(:ensure => 'present') }
|
||||
|
||||
end
|
||||
|
||||
context 'with manage_cradox and manage_rados to true' do
|
||||
before do
|
||||
params.merge!({
|
||||
:manage_cradox => true,
|
||||
:manage_rados => true,
|
||||
})
|
||||
end
|
||||
|
||||
it { is_expected.to raise_error(Puppet::Error, /gnocchi::storage::ceph::manage_rados and gnocchi::storage::ceph::manage_cradox both cannot be set to true./) }
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'gnocchi storage ceph cradox redhat' do
|
||||
context 'with manage_cradox to true' do
|
||||
before do
|
||||
params.merge!({
|
||||
:manage_cradox => true,
|
||||
:manage_rados => false,
|
||||
})
|
||||
end
|
||||
|
||||
it { is_expected.to contain_package('python-cradox').with(:ensure => 'present') }
|
||||
it { is_expected.not_to contain_package('python-rados') }
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'gnocchi storage ceph cradox debian' do
|
||||
context 'with manage_cradox to true' do
|
||||
before do
|
||||
params.merge!({
|
||||
:manage_cradox => true,
|
||||
:manage_rados => false,
|
||||
})
|
||||
end
|
||||
|
||||
it { is_expected.to raise_error(Puppet::Error, /gnocchi::storage::ceph::manage_cradox set to true on debian family will fail due to no package being available./) }
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
|
@ -56,6 +112,13 @@ describe 'gnocchi::storage::ceph' do
|
|||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
case facts[:osfamily]
|
||||
when 'Debian'
|
||||
it_behaves_like 'gnocchi storage ceph cradox debian'
|
||||
when 'RedHat'
|
||||
it_behaves_like 'gnocchi storage ceph cradox redhat'
|
||||
end
|
||||
|
||||
it_behaves_like 'gnocchi storage ceph'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue