Merge "Allow setting pool application tag as supported from the Luminous release."

This commit is contained in:
Zuul
2018-10-17 01:39:55 +00:00
committed by Gerrit Code Review
2 changed files with 22 additions and 0 deletions

View File

@@ -43,6 +43,10 @@
# Optional. Default is undef. # Optional. Default is undef.
# Increase or decrease the replica level of a pool. # 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 # [*exec_timeout*] The default exec resource timeout, in seconds
# Optional. Defaults to $::ceph::params::exec_timeout # Optional. Defaults to $::ceph::params::exec_timeout
# #
@@ -51,6 +55,7 @@ define ceph::pool (
$pg_num = 64, $pg_num = 64,
$pgp_num = undef, $pgp_num = undef,
$size = undef, $size = undef,
$tag = undef,
$exec_timeout = $::ceph::params::exec_timeout, $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 { } elsif $ensure == absent {
exec { "delete-${name}": exec { "delete-${name}":

View File

@@ -33,6 +33,7 @@ describe 'ceph::pool' do
:pg_num => 3, :pg_num => 3,
:pgp_num => 4, :pgp_num => 4,
:size => 2, :size => 2,
:tag => 'rbd',
} }
end end
@@ -49,6 +50,9 @@ describe 'ceph::pool' do
is_expected.to contain_exec('set-volumes-size').with( 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" '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') is_expected.not_to contain_exec('delete-volumes')
} }