Merge pull request #421 from enovance/fix-keyring

Update Ceph Keyring
This commit is contained in:
Sebastien Badia 2014-04-15 13:50:18 +02:00
commit 9fcc32e5aa
6 changed files with 65 additions and 57 deletions

View File

@ -2,7 +2,7 @@ fixtures:
repositories: repositories:
'cinder': 'cinder':
repo: 'git://github.com/enovance/puppet-cinder' repo: 'git://github.com/enovance/puppet-cinder'
ref: 'd92b38a8c7bb484e935ed21510843ef6be8e31d3' ref: 'bd1536626f2b5d66f9ea77bcd69ba7d1f5f33961'
'keystone': 'keystone':
repo: 'git://github.com/enovance/puppet-keystone.git' repo: 'git://github.com/enovance/puppet-keystone.git'
ref: '9802add6566646dc1e4a2812d19c2ab4724ff594' ref: '9802add6566646dc1e4a2812d19c2ab4724ff594'

View File

@ -22,7 +22,7 @@ mod 'ceilometer',
:ref => 'f71f935a3e41dcd11f8f5986a1fe0708b124e589' :ref => 'f71f935a3e41dcd11f8f5986a1fe0708b124e589'
mod 'cinder', mod 'cinder',
:git => 'git://github.com/enovance/puppet-cinder.git', :git => 'git://github.com/enovance/puppet-cinder.git',
:ref => 'd92b38a8c7bb484e935ed21510843ef6be8e31d3' :ref => 'bd1536626f2b5d66f9ea77bcd69ba7d1f5f33961'
mod 'glance', mod 'glance',
:git => 'git://github.com/enovance/puppet-glance.git', :git => 'git://github.com/enovance/puppet-glance.git',
:ref => '001f1b6a8ef6bd0fde8fbe0a4b3362f31e6bbcda' :ref => '001f1b6a8ef6bd0fde8fbe0a4b3362f31e6bbcda'

View File

@ -150,9 +150,10 @@ Host *
ensure => 'present' ensure => 'present'
}) })
@user { 'nova': groups => 'cephkeyring' } ensure_resource ('exec','add-nova-to-group', {
User <| title == nova |> 'command' => 'usermod -a -G cephkeyring nova',
realize User[nova] 'unless' => 'groups nova | grep cephkeyring'
})
ensure_resource('file', "/etc/ceph/ceph.client.${cinder_rbd_user}.keyring", { ensure_resource('file', "/etc/ceph/ceph.client.${cinder_rbd_user}.keyring", {
owner => 'root', owner => 'root',

View File

@ -80,9 +80,10 @@ define cloud::volume::backend::rbd (
ensure => 'present' ensure => 'present'
}) })
@user { 'cinder': groups => 'cephkeyring' } ensure_resource ('exec','add-cinder-to-group', {
User <| title == cinder |> 'command' => 'usermod -a -G cephkeyring cinder',
realize User[cinder] 'unless' => 'groups cinder | grep cephkeyring'
})
ensure_resource('file', "/etc/ceph/ceph.client.${rbd_user}.keyring", { ensure_resource('file', "/etc/ceph/ceph.client.${rbd_user}.keyring", {
owner => 'root', owner => 'root',

View File

@ -248,6 +248,10 @@ describe 'cloud::compute::hypervisor' do
should contain_nova_config('DEFAULT/rbd_user').with('value' => 'cinder') should contain_nova_config('DEFAULT/rbd_user').with('value' => 'cinder')
should contain_nova_config('DEFAULT/rbd_secret_uuid').with('value' => 'secrete') should contain_nova_config('DEFAULT/rbd_secret_uuid').with('value' => 'secrete')
should contain_group('cephkeyring').with(:ensure => 'present') should contain_group('cephkeyring').with(:ensure => 'present')
should contain_exec('add-nova-to-group').with(
:command => 'usermod -a -G cephkeyring nova',
:unless => 'groups nova | grep cephkeyring'
)
end end
it 'configure nova-compute with extra parameters' do it 'configure nova-compute with extra parameters' do

View File

@ -107,6 +107,10 @@ describe 'cloud::volume::storage' do
:os_auth_url => 'http://keystone.host:5000/v2.0' :os_auth_url => 'http://keystone.host:5000/v2.0'
) )
should contain_group('cephkeyring').with(:ensure => 'present') should contain_group('cephkeyring').with(:ensure => 'present')
should contain_exec('add-cinder-to-group').with(
:command => 'usermod -a -G cephkeyring cinder',
:unless => 'groups cinder | grep cephkeyring'
)
end end
end end
@ -123,55 +127,53 @@ describe 'cloud::volume::storage' do
end end
end end
# This context can't work now, because of https://bugs.launchpad.net/puppet-cinder/+bug/1294138 context 'with two RBD backends' do
# context 'with two RBD backends' do before :each do
# before :each do params.merge!(
# params.merge!( :cinder_backends => {
# :cinder_backends => { 'rbd' => {
# 'rbd' => { 'lowcost' => {
# 'lowcost' => { 'rbd_pool' => 'low',
# 'rbd_pool' => 'low', 'rbd_user' => 'cinder',
# 'rbd_user' => 'cinder', 'rbd_secret_uuid' => 'secret',
# 'rbd_secret_uuid' => 'secret', },
# }, 'normal' => {
# 'normal' => { 'rbd_pool' => 'normal',
# 'rbd_pool' => 'normal', 'rbd_user' => 'cinder',
# 'rbd_user' => 'cinder', 'rbd_secret_uuid' => 'secret',
# 'rbd_secret_uuid' => 'secret', }
# } }
# } }
# } )
# ) end
# end
# it 'configures two rbd volume backends' do
# should contain_cinder_config('lowcost/volume_backend_name').with_value('lowcost')
# it 'configures two rbd volume backends' do should contain_cinder_config('lowcost/rbd_pool').with_value('low')
# should contain_cinder_config('lowcost/volume_backend_name').with_value('lowcost') should contain_cinder_config('lowcost/rbd_user').with_value('cinder')
# should contain_cinder_config('lowcost/rbd_pool').with_value('low') should contain_cinder_config('lowcost/rbd_secret_uuid').with_value('secret')
# should contain_cinder_config('lowcost/rbd_user').with_value('cinder') should contain_cinder__type('lowcost').with(
# should contain_cinder_config('lowcost/rbd_secret_uuid').with_value('secret') :set_key => 'volume_backend_name',
# should contain_cinder__type('lowcost').with( :set_value => 'lowcost',
# :set_key => 'volume_backend_name', :os_tenant_name => 'services',
# :set_value => 'lowcost', :os_username => 'cinder',
# :os_tenant_name => 'services', :os_password => 'secret',
# :os_username => 'cinder', :os_auth_url => 'http://keystone.host:5000/v2.0'
# :os_password => 'secret', )
# :os_auth_url => 'http://keystone.host:5000/v2.0' should contain_cinder_config('normal/volume_backend_name').with_value('normal')
# ) should contain_cinder_config('normal/rbd_pool').with_value('normal')
# should contain_cinder_config('normal/volume_backend_name').with_value('normal') should contain_cinder_config('normal/rbd_user').with_value('cinder')
# should contain_cinder_config('normal/rbd_pool').with_value('normal') should contain_cinder_config('normal/rbd_secret_uuid').with_value('secret')
# should contain_cinder_config('normal/rbd_user').with_value('cinder') should contain_cinder__type('normal').with(
# should contain_cinder_config('normal/rbd_secret_uuid').with_value('secret') :set_key => 'volume_backend_name',
# should contain_cinder__type('normal').with( :set_value => 'normal',
# :set_key => 'volume_backend_name', :os_tenant_name => 'services',
# :set_value => 'normal', :os_username => 'cinder',
# :os_tenant_name => 'services', :os_password => 'secret',
# :os_username => 'cinder', :os_auth_url => 'http://keystone.host:5000/v2.0'
# :os_password => 'secret', )
# :os_auth_url => 'http://keystone.host:5000/v2.0' end
# ) end
# end
# end
context 'with all backends enabled' do context 'with all backends enabled' do
it 'configure all cinder backends' do it 'configure all cinder backends' do