Handle sparse image upload configuration parameters

Addng ``rbd_thin_provisioning`` and ``filesystem_thin_provisioning``
to rbd and filesystem backends, to enable or not sparse upload.

Depends-On: Ic95fa45af0f1db92d8425862c6267f466764fbbe
Change-Id: I90c8ea98a96fa57f5bf3bf0c6b2b37ec95474baf
This commit is contained in:
PranaliD 2020-09-10 10:12:02 +00:00 committed by Takashi Kajinami
parent ce090228c0
commit 71b70a16b3
4 changed files with 58 additions and 8 deletions

View File

@ -29,6 +29,10 @@
# (Optional) Location where dist images are stored when the backend type is file.
# Defaults to hiera('glance::backend::file::filesystem_store_datadir', undef).
#
# [*filesystem_thin_provisioning*]
# (Optional) Boolean describing if thin provisioning is enabled or not
# Defaults to hiera('glance::backend::file::filesystem_thin_provisioning', undef).
#
# [*store_description*]
# (Optional) Provides constructive information about the store backend to
# end users.
@ -41,10 +45,11 @@
#
class tripleo::profile::base::glance::backend::file (
$backend_names,
$multistore_config = {},
$filesystem_store_datadir = hiera('glance::backend::file::filesystem_store_datadir', undef),
$store_description = hiera('tripleo::profile::base::glance::api::glance_store_description', 'File store'),
$step = Integer(hiera('step')),
$multistore_config = {},
$filesystem_store_datadir = hiera('glance::backend::file::filesystem_store_datadir', undef),
$filesystem_thin_provisioning = hiera('glance::backend::file::filesystem_thin_provisioning', undef),
$store_description = hiera('tripleo::profile::base::glance::api::glance_store_description', 'File store'),
$step = Integer(hiera('step')),
) {
if $backend_names.length() > 1 {
@ -58,8 +63,9 @@ class tripleo::profile::base::glance::backend::file (
$store_description_real = pick($multistore_description, $store_description)
glance::backend::multistore::file { $backend_name:
filesystem_store_datadir => $filesystem_store_datadir,
store_description => $store_description_real,
filesystem_store_datadir => $filesystem_store_datadir,
filesystem_thin_provisioning => $filesystem_thin_provisioning,
store_description => $store_description_real,
}
}
}

View File

@ -41,6 +41,10 @@
# (Optional) RBD chunk size.
# Defaults to hiera('glance::backend::rbd::rbd_store_chunk_size', undef).
#
# [*rbd_thin_provisioning*]
# (Optional) Boolean describing if thin provisioning is enabled or not
# Defaults to hiera('glance::backend::rbd::rbd_thin_provisioning', undef).
#
# [*rados_connect_timeout*]
# (Optional) RADOS connection timeout.
# Defaults to hiera('glance::backend::rbd::rados_connect_timeout', undef).
@ -62,6 +66,7 @@ class tripleo::profile::base::glance::backend::rbd (
$rbd_store_user = hiera('glance::backend::rbd::rbd_store_user', 'openstack'),
$rbd_store_pool = hiera('glance::backend::rbd::rbd_store_pool', 'images'),
$rbd_store_chunk_size = hiera('glance::backend::rbd::rbd_store_chunk_size', undef),
$rbd_thin_provisioning = hiera('glance::backend::rbd::rbd_thin_provisioning', undef),
$rados_connect_timeout = hiera('glance::backend::rbd::rados_connect_timeout', undef),
$store_description = hiera('tripleo::profile::base::glance::api::glance_store_description', 'RBD store'),
$step = Integer(hiera('step')),
@ -102,6 +107,7 @@ class tripleo::profile::base::glance::backend::rbd (
rbd_store_user => $rbd_store_user_real,
rbd_store_pool => $rbd_store_pool_real,
rbd_store_chunk_size => $rbd_store_chunk_size,
rbd_thin_provisioning => $rbd_thin_provisioning,
rados_connect_timeout => $rados_connect_timeout,
store_description => $store_description_real,
}

View File

@ -49,6 +49,22 @@ describe 'tripleo::profile::base::glance::backend::file' do
)
end
context 'with parameters overridden' do
before :each do
params.merge!({
:filesystem_thin_provisioning => true
})
it 'should configure the backend with the specified parameters' do
is_expected.to contain_glance__backend__multistore__file('my_file').with(
:filesystem_store_datadir => '/path/to/datadir',
:filesystem_thin_provisioning => true,
:store_description => 'File store',
)
end
end
end
context 'with store description in multistore_config' do
before :each do
params.merge!({

View File

@ -37,8 +37,8 @@ describe 'tripleo::profile::base::glance::backend::rbd' do
context 'with step 4' do
let(:params) { {
:backend_names => ['my_rbd'],
:step => 4,
:backend_names => ['my_rbd'],
:step => 4,
} }
it 'should configure the backend' do
@ -56,6 +56,28 @@ describe 'tripleo::profile::base::glance::backend::rbd' do
)
end
context 'with parameters overridden' do
before :each do
params.merge!({
:rbd_store_chunk_size => 512,
:rbd_thin_provisioning => true,
:rados_connect_timeout => 10,
})
it 'should configure the backend with the specified parameters' do
is_expected.to contain_glance__backend__multistore__rbd('my_rbd').with(
:rbd_store_ceph_conf => '/etc/ceph/ceph.conf',
:rbd_store_user => 'openstack',
:rbd_store_pool => 'images',
:rbd_store_chunk_size => 512,
:rbd_thin_provisioning => true,
:rados_connect_timeout => 10,
:store_description => 'RBD store',
)
end
end
end
context 'with store description in multistore_config' do
before :each do
params.merge!({