diff --git a/manifests/pool.pp b/manifests/pool.pp index 87f4cca9..522a98ad 100644 --- a/manifests/pool.pp +++ b/manifests/pool.pp @@ -43,6 +43,10 @@ # Optional. Default is undef. # Increase or decrease the replica level of a pool. # +# [*tag*] Pool tag. +# Optional. Default is undef. +# cephfs,rbd,rgw or freeform for custom application. +# # [*exec_timeout*] The default exec resource timeout, in seconds # Optional. Defaults to $::ceph::params::exec_timeout # @@ -51,6 +55,7 @@ define ceph::pool ( $pg_num = 64, $pgp_num = undef, $size = undef, + $tag = undef, $exec_timeout = $::ceph::params::exec_timeout, ) { @@ -107,6 +112,19 @@ test $(ceph osd pool get ${name} size | sed 's/.*:\s*//g') -eq ${size}", } } + if $tag { + exec { "set-${name}-tag": + command => "/bin/true # comment to satisfy puppet syntax requirements +set -ex +ceph osd pool application enable ${name} ${tag}", + unless => "/bin/true # comment to satisfy puppet syntax requirements +set -ex +ceph osd pool application get ${name} ${tag}", + require => Exec["create-${name}"], + timeout => $exec_timeout, + } + } + } elsif $ensure == absent { exec { "delete-${name}": diff --git a/spec/defines/ceph_pool_spec.rb b/spec/defines/ceph_pool_spec.rb index 1510ea1f..5181d013 100644 --- a/spec/defines/ceph_pool_spec.rb +++ b/spec/defines/ceph_pool_spec.rb @@ -33,6 +33,7 @@ describe 'ceph::pool' do :pg_num => 3, :pgp_num => 4, :size => 2, + :tag => 'rbd', } end @@ -49,6 +50,9 @@ describe 'ceph::pool' do is_expected.to contain_exec('set-volumes-size').with( 'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph osd pool set volumes size 2" ) + is_expected.to contain_exec('set-volumes-tag').with( + 'command' => "/bin/true # comment to satisfy puppet syntax requirements\nset -ex\nceph osd pool application enable volumes rbd" + ) is_expected.not_to contain_exec('delete-volumes') }