From 69160b7a04f0b6862632a8aa4a703f891b54cdf7 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 8 Oct 2018 22:32:25 +0100 Subject: [PATCH] Allow setting pool application tag as supported from the Luminous release. Depends-On: https://review.openstack.org/#/c/612481/ Change-Id: I956001fd7ee8a15b1b9f3032bb8f898c32ba9ac3 Closes-Bug: #1796761 (cherry picked from commit 9dc34406f6f6c17730d0b52d8948f6f550153186) --- manifests/pool.pp | 18 ++++++++++++++++++ spec/defines/ceph_pool_spec.rb | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/manifests/pool.pp b/manifests/pool.pp index 2d0df203..2df769c4 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') }