Install ceph client libraries when using rbd
Ceph client libraries might not be installed when using the nova::compute::rbd class. Change-Id: Icc2c8e688abbc6d8a1877bfea7be6b30204d1a52
This commit is contained in:
parent
fab38766c4
commit
69870241d1
|
@ -54,6 +54,13 @@
|
|||
# ephemeral storage or for the cinder volumes only.
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*manage_ceph_client*]
|
||||
# (optional) Whether to manage the ceph client package.
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*ceph_client_ensure*]
|
||||
# (optional) Ensure value for ceph client package.
|
||||
# Defaults to 'present'.
|
||||
|
||||
class nova::compute::rbd (
|
||||
$libvirt_rbd_user,
|
||||
|
@ -63,11 +70,22 @@ class nova::compute::rbd (
|
|||
$libvirt_images_rbd_ceph_conf = '/etc/ceph/ceph.conf',
|
||||
$rbd_keyring = 'client.nova',
|
||||
$ephemeral_storage = true,
|
||||
$manage_ceph_client = true,
|
||||
$ceph_client_ensure = 'present',
|
||||
) {
|
||||
|
||||
include ::nova::deps
|
||||
include ::nova::params
|
||||
|
||||
if $manage_ceph_client {
|
||||
# Install ceph client libraries
|
||||
package { 'ceph-client-package':
|
||||
ensure => $ceph_client_ensure,
|
||||
name => $nova::params::ceph_client_package_name,
|
||||
tag => ['openstack'],
|
||||
}
|
||||
}
|
||||
|
||||
nova_config {
|
||||
'libvirt/rbd_user': value => $libvirt_rbd_user;
|
||||
}
|
||||
|
@ -85,7 +103,7 @@ class nova::compute::rbd (
|
|||
exec { 'get-or-set virsh secret':
|
||||
command => '/usr/bin/virsh secret-define --file /etc/nova/secret.xml | /usr/bin/awk \'{print $2}\' | sed \'/^$/d\' > /etc/nova/virsh.secret',
|
||||
creates => '/etc/nova/virsh.secret',
|
||||
require => File['/etc/nova/secret.xml']
|
||||
require => [File['/etc/nova/secret.xml'], Package['ceph-client-package']],
|
||||
}
|
||||
|
||||
if $libvirt_rbd_secret_key {
|
||||
|
|
|
@ -28,6 +28,7 @@ class nova::params {
|
|||
$spicehtml5proxy_package_name = 'openstack-nova-console'
|
||||
$sqlite_package_name = undef
|
||||
$pymysql_package_name = undef
|
||||
$ceph_client_package_name = 'ceph-common'
|
||||
# service names
|
||||
$api_service_name = 'openstack-nova-api'
|
||||
$cells_service_name = 'openstack-nova-cells'
|
||||
|
@ -84,6 +85,7 @@ class nova::params {
|
|||
$serialproxy_package_name = 'nova-serialproxy'
|
||||
$sqlite_package_name = 'python-pysqlite2'
|
||||
$pymysql_package_name = 'python-pymysql'
|
||||
$ceph_client_package_name = 'ceph'
|
||||
# service names
|
||||
$api_service_name = 'nova-api'
|
||||
$cells_service_name = 'nova-cells'
|
||||
|
|
|
@ -41,6 +41,13 @@ describe 'nova::compute::rbd' do
|
|||
is_expected.to contain_nova_config('libvirt/rbd_user').with_value('nova')
|
||||
end
|
||||
|
||||
it 'installs client package' do
|
||||
is_expected.to contain_package('ceph-client-package').with(
|
||||
'name' => platform_params[:ceph_client_package],
|
||||
'ensure' => 'present'
|
||||
)
|
||||
end
|
||||
|
||||
context 'when overriding default parameters' do
|
||||
before :each do
|
||||
params.merge!(
|
||||
|
@ -83,7 +90,7 @@ describe 'nova::compute::rbd' do
|
|||
is_expected.to contain_exec('get-or-set virsh secret').with(
|
||||
:command => '/usr/bin/virsh secret-define --file /etc/nova/secret.xml | /usr/bin/awk \'{print $2}\' | sed \'/^$/d\' > /etc/nova/virsh.secret',
|
||||
:creates => '/etc/nova/virsh.secret',
|
||||
:require => 'File[/etc/nova/secret.xml]'
|
||||
:require => ['File[/etc/nova/secret.xml]', 'Package[ceph-client-package]']
|
||||
)
|
||||
is_expected.to contain_exec('set-secret-value virsh').with(
|
||||
:command => "/usr/bin/virsh secret-set-value --secret UUID --base64 $(ceph auth get-key client.rbd_test)"
|
||||
|
@ -134,7 +141,7 @@ describe 'nova::compute::rbd' do
|
|||
is_expected.to contain_exec('get-or-set virsh secret').with(
|
||||
:command => '/usr/bin/virsh secret-define --file /etc/nova/secret.xml | /usr/bin/awk \'{print $2}\' | sed \'/^$/d\' > /etc/nova/virsh.secret',
|
||||
:creates => '/etc/nova/virsh.secret',
|
||||
:require => 'File[/etc/nova/secret.xml]'
|
||||
:require => ['File[/etc/nova/secret.xml]', 'Package[ceph-client-package]'],
|
||||
)
|
||||
is_expected.to contain_exec('set-secret-value virsh').with(
|
||||
:command => "/usr/bin/virsh secret-set-value --secret UUID --base64 $(ceph auth get-key client.rbd_test)"
|
||||
|
@ -142,6 +149,15 @@ describe 'nova::compute::rbd' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when not managing ceph client' do
|
||||
before :each do
|
||||
params.merge!(
|
||||
:manage_ceph_client => false
|
||||
)
|
||||
end
|
||||
|
||||
it { is_expected.to_not contain_package('ceph-client-package') }
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
|
@ -149,6 +165,10 @@ describe 'nova::compute::rbd' do
|
|||
@default_facts.merge({ :osfamily => 'Debian' })
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :ceph_client_package => 'ceph'}
|
||||
end
|
||||
|
||||
it_configures 'nova compute rbd'
|
||||
end
|
||||
|
||||
|
@ -157,6 +177,10 @@ describe 'nova::compute::rbd' do
|
|||
@default_facts.merge({ :osfamily => 'RedHat' })
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :ceph_client_package => 'ceph-common' }
|
||||
end
|
||||
|
||||
it_configures 'nova compute rbd'
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue