From c15e60283b742a51a3683bbd56ae628230b4d788 Mon Sep 17 00:00:00 2001 From: Sebastien Badia Date: Thu, 23 Jan 2014 18:46:45 +0100 Subject: [PATCH] [storage/rbd] Fix Ceph::Key[admin] dependency Ceph admin key is populated by a fact and exported through a exported resource, a require on Ceph::Key class has no sens here, and this bloc the run. A better solution is to test if the value is empty and run pool creation then. This commit Close #18 and I've successfully tested this on os-ci-test9 ! Please see: https://github.com/enovance/puppet-cloud/issues/18 https://github.com/enovance/openstack-puppet-ci/blob/master/site.pp#L145-L148 https://github.com/enovance/puppet-ceph/blob/master/lib/facter/ceph_osd_bootstrap_key.rb#L18-L21 --- manifests/storage/rbd/pools.pp | 49 ++++++++++++++++------------------ 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/manifests/storage/rbd/pools.pp b/manifests/storage/rbd/pools.pp index a1e83ac2..bce58a62 100644 --- a/manifests/storage/rbd/pools.pp +++ b/manifests/storage/rbd/pools.pp @@ -28,35 +28,32 @@ class cloud::storage::rbd::pools( if $setup_pools { - # ceph osd pool create poolname 128 128 - exec { 'create_glance_images_pool': - command => "rados mkpool ${glance_pool} ${pool_default_pg_num} ${pool_default_pgp_num}", - unless => "rados lspools | grep -sq ${glance_pool}", - require => Ceph::Key['admin']; - } + if !empty($::ceph_admin_key) { + # ceph osd pool create poolname 128 128 + exec { 'create_glance_images_pool': + command => "rados mkpool ${glance_pool} ${pool_default_pg_num} ${pool_default_pgp_num}", + unless => "rados lspools | grep -sq ${glance_pool}", + } - exec { 'create_glance_images_user_and_key': - command => "ceph auth get-or-create client.${glance_user} mon 'allow r' \ -osd 'allow class-read object_prefix rbd_children, allow rwx pool=${glance_pool}'", - unless => "ceph auth list 2> /dev/null | egrep -sq '^client.${glance_user}$'", - require => Exec['create_glance_images_pool']; - } + exec { 'create_glance_images_user_and_key': + command => "ceph auth get-or-create client.${glance_user} mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=${glance_pool}'", + unless => "ceph auth list 2> /dev/null | egrep -sq '^client.${glance_user}$'", + require => Exec['create_glance_images_pool']; + } + # ceph osd pool create poolname 128 128 + exec { 'create_cinder_volumes_pool': + command => "rados mkpool ${cinder_pool} ${pool_default_pg_num} ${pool_default_pgp_num}", + unless => "/usr/bin/rados lspools | grep -sq ${cinder_pool}", + } - # ceph osd pool create poolname 128 128 - exec { 'create_cinder_volumes_pool': - command => "rados mkpool ${cinder_pool} ${pool_default_pg_num} ${pool_default_pgp_num}", - unless => "/usr/bin/rados lspools | grep -sq ${cinder_pool}", - require => Ceph::Key['admin']; - } - - exec { 'create_cinder_volumes_user_and_key': - # TODO: point PG num with a cluster variable - command => "ceph auth get-or-create client.${cinder_user} mon 'allow r' \ -osd 'allow class-read object_prefix rbd_children, allow rwx pool=${glance_pool}, allow rx pool=${cinder_pool}'", - unless => "ceph auth list 2> /dev/null | egrep -sq '^client.${cinder_user}$'", - require => Exec['create_cinder_volumes_pool']; - } + exec { 'create_cinder_volumes_user_and_key': + # TODO: point PG num with a cluster variable + command => "ceph auth get-or-create client.${cinder_user} mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=${glance_pool}, allow rx pool=${cinder_pool}'", + unless => "ceph auth list 2> /dev/null | egrep -sq '^client.${cinder_user}$'", + require => Exec['create_cinder_volumes_pool']; + } + } # !empty($::ceph_admin_key) # exec { "create cinder backup pool": # # TODO: point PG num with a cluster variable + keyring