Allow setting pool application tag as supported from the Luminous

release.

Change-Id: I956001fd7ee8a15b1b9f3032bb8f898c32ba9ac3
Closes-Bug: #1796761
This commit is contained in:
Dan Williams 2018-10-08 22:32:25 +01:00
parent 9334bf41cb
commit 9dc34406f6
2 changed files with 22 additions and 0 deletions

View File

@ -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}":

View File

@ -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')
}