From c98f003cfd65aea72ece4fd975a97df6a289b503 Mon Sep 17 00:00:00 2001 From: Sebastien Badia Date: Tue, 28 Jan 2014 16:50:25 +0100 Subject: [PATCH] Ceph/Virsh token: Enclose also exported ressources into ceph::admin::key Close GH-97 --- manifests/storage/rbd/pools.pp | 62 ++++++++++++++++------------------ 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/manifests/storage/rbd/pools.pp b/manifests/storage/rbd/pools.pp index 4f628483..369f3d8a 100644 --- a/manifests/storage/rbd/pools.pp +++ b/manifests/storage/rbd/pools.pp @@ -27,8 +27,8 @@ class cloud::storage::rbd::pools( ) { if $setup_pools { - 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}", @@ -53,37 +53,35 @@ class cloud::storage::rbd::pools( unless => "ceph auth list 2> /dev/null | egrep -sq '^client.${cinder_user}$'", require => Exec['create_cinder_volumes_pool']; } + +#exec { "create cinder backup pool": +#TODO: point PG num with a cluster variable + keyring +# command => "/usr/bin/ceph osd pool create ${::cinder_backup_pool} 128 128", +# command => "ceph auth get-or-create client.${::cinder_backup_user} mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=${::cinder_backup_pool}'", +# unless => "/usr/bin/rados lspools | grep -sq ${::cinder_backup_pool}", +# unless => "ceph auth list | egrep '^${::cinder_backup_pool}$'", +# require => Ceph::Key['admin'], +#} + + @@file { '/etc/ceph/secret.xml': + content => template('cloud/storage/ceph/secret-compute.xml.erb'), + tag => 'ceph_compute_secret_file', + } + + @@exec { 'get_or_set_virsh_secret': + command => 'virsh secret-define --file /etc/ceph/secret.xml', + unless => "virsh secret-list | tail -n +3 | cut -f1 -d' ' | grep -sq ${ceph_fsid}", + tag => 'ceph_compute_get_secret', + require => [Package['libvirt-bin'],File['/etc/ceph/secret.xml']], + notify => Exec['set_secret_value_virsh'], + } + + @@exec { 'set_secret_value_virsh': + command => "virsh secret-set-value --secret ${ceph_fsid} --base64 ${::ceph_keyring_glance}", + tag => 'ceph_compute_set_secret', + refreshonly => true, + } + } # !empty($::ceph_admin_key) - -# exec { "create cinder backup pool": -# # TODO: point PG num with a cluster variable + keyring -# command => "/usr/bin/ceph osd pool create ${::cinder_backup_pool} 128 128", -# command => "\ -#ceph auth get-or-create client.${::cinder_backup_user} mon 'allow r' \ -#osd 'allow class-read object_prefix rbd_children, allow rwx pool=${::cinder_backup_pool}'", -# unless => "/usr/bin/rados lspools | grep -sq ${::cinder_backup_pool}", -# unless => "ceph auth list | egrep '^${::cinder_backup_pool}$'", -# require => Ceph::Key['admin'], -# } - - @@file { '/etc/ceph/secret.xml': - content => template('cloud/storage/ceph/secret-compute.xml.erb'), - tag => 'ceph_compute_secret_file', - } - - @@exec { 'get_or_set_virsh_secret': - command => 'virsh secret-define --file /etc/ceph/secret.xml', - unless => "virsh secret-list | tail -n +3 | cut -f1 -d' ' | grep -sq ${ceph_fsid}", - tag => 'ceph_compute_get_secret', - require => [Package['libvirt-bin'],File['/etc/ceph/secret.xml']], - notify => Exec['set_secret_value_virsh'], - } - - @@exec { 'set_secret_value_virsh': - command => "virsh secret-set-value --secret ${ceph_fsid} --base64 ${::ceph_keyring_glance}", - tag => 'ceph_compute_set_secret', - refreshonly => true, - } - } # if setup pools } # class