Add support for reserved backend options
This change introduces support for the following two reserved backends, which were added by [1]. [1] 6dba83ba3a7c047df282f2edb7217548f43d6251 Change-Id: I9e809f5ba25516b0974015ea5259d1ab7f5bb1ca
This commit is contained in:
parent
daa8abd50a
commit
d82df7aedd
51
manifests/backend/reserved/staging.pp
Normal file
51
manifests/backend/reserved/staging.pp
Normal file
@ -0,0 +1,51 @@
|
||||
#
|
||||
# Copyright 2022 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# == Class: glance::backend::reserved::staging
|
||||
#
|
||||
# Used to configure the os_glance_staging_store options
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*filesystem_store_datadir*]
|
||||
# (optional) Directory where dist images are stored.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*filesystem_store_file_perm*]
|
||||
# (optional) File access permissions for the image files.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*filesystem_store_chunk_size*]
|
||||
# (optional) Chunk size, in bytes.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*filesystem_thin_provisioning*]
|
||||
# (optional) Boolean describing if thin provisioning is enabled or not
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
class glance::backend::reserved::staging(
|
||||
$filesystem_store_datadir = $::os_service_default,
|
||||
$filesystem_store_file_perm = $::os_service_default,
|
||||
$filesystem_store_chunk_size = $::os_service_default,
|
||||
$filesystem_thin_provisioning = $::os_service_default,
|
||||
) {
|
||||
|
||||
glance_api_config {
|
||||
'os_glance_staging_store/filesystem_store_datadir': value => $filesystem_store_datadir;
|
||||
'os_glance_staging_store/filesystem_store_file_perm': value => $filesystem_store_file_perm;
|
||||
'os_glance_staging_store/filesystem_store_chunk_size': value => $filesystem_store_chunk_size;
|
||||
'os_glance_staging_store/filesystem_thin_provisioning': value => $filesystem_thin_provisioning;
|
||||
}
|
||||
}
|
51
manifests/backend/reserved/tasks.pp
Normal file
51
manifests/backend/reserved/tasks.pp
Normal file
@ -0,0 +1,51 @@
|
||||
#
|
||||
# Copyright 2022 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# == Class: glance::backend::reserved::tasks
|
||||
#
|
||||
# Used to configure the os_glance_task_store options
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*filesystem_store_datadir*]
|
||||
# (optional) Directory where dist images are stored.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*filesystem_store_file_perm*]
|
||||
# (optional) File access permissions for the image files.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*filesystem_store_chunk_size*]
|
||||
# (optional) Chunk size, in bytes.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*filesystem_thin_provisioning*]
|
||||
# (optional) Boolean describing if thin provisioning is enabled or not
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
class glance::backend::reserved::tasks(
|
||||
$filesystem_store_datadir = $::os_service_default,
|
||||
$filesystem_store_file_perm = $::os_service_default,
|
||||
$filesystem_store_chunk_size = $::os_service_default,
|
||||
$filesystem_thin_provisioning = $::os_service_default,
|
||||
) {
|
||||
|
||||
glance_api_config {
|
||||
'os_glance_tasks_store/filesystem_store_datadir': value => $filesystem_store_datadir;
|
||||
'os_glance_tasks_store/filesystem_store_file_perm': value => $filesystem_store_file_perm;
|
||||
'os_glance_tasks_store/filesystem_store_chunk_size': value => $filesystem_store_chunk_size;
|
||||
'os_glance_tasks_store/filesystem_thin_provisioning': value => $filesystem_thin_provisioning;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The following two new classes have been added.
|
||||
|
||||
- The ``glance::backend::reserved::tasks`` class, to manage
|
||||
the ``os_glance_tasks_store`` options.
|
||||
- The ``glance::backend::reserved::staging`` class, to manage
|
||||
the ``os_glance_staging_store`` options.
|
47
spec/classes/glance_backend_reserved_staging_spec.rb
Normal file
47
spec/classes/glance_backend_reserved_staging_spec.rb
Normal file
@ -0,0 +1,47 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'glance::backend::reserved::staging' do
|
||||
|
||||
shared_examples_for 'glance::backend::reserved::staging' do
|
||||
it 'configures glance-api.conf' do
|
||||
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_store_datadir').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_store_file_perm').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_store_chunk_size').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_thin_provisioning').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
describe 'when overriding datadir' do
|
||||
let :params do
|
||||
{
|
||||
:filesystem_store_datadir => '/var/lib/glance/staging',
|
||||
:filesystem_store_file_perm => 0,
|
||||
:filesystem_store_chunk_size => 65536,
|
||||
:filesystem_thin_provisioning => true,
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures glance-api.conf' do
|
||||
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_store_datadir')\
|
||||
.with_value('/var/lib/glance/staging')
|
||||
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_store_file_perm')\
|
||||
.with_value(0)
|
||||
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_store_chunk_size')\
|
||||
.with_value(65536)
|
||||
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_thin_provisioning')\
|
||||
.with_value(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'glance::backend::reserved::staging'
|
||||
end
|
||||
end
|
||||
end
|
47
spec/classes/glance_backend_reserved_tasks_spec.rb
Normal file
47
spec/classes/glance_backend_reserved_tasks_spec.rb
Normal file
@ -0,0 +1,47 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'glance::backend::reserved::tasks' do
|
||||
|
||||
shared_examples_for 'glance::backend::reserved::tasks' do
|
||||
it 'configures glance-api.conf' do
|
||||
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_store_datadir').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_store_file_perm').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_store_chunk_size').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_thin_provisioning').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
describe 'when overriding datadir' do
|
||||
let :params do
|
||||
{
|
||||
:filesystem_store_datadir => '/var/lib/glance/tasks',
|
||||
:filesystem_store_file_perm => 0,
|
||||
:filesystem_store_chunk_size => 65536,
|
||||
:filesystem_thin_provisioning => true,
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures glance-api.conf' do
|
||||
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_store_datadir')\
|
||||
.with_value('/var/lib/glance/tasks')
|
||||
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_store_file_perm')\
|
||||
.with_value(0)
|
||||
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_store_chunk_size')\
|
||||
.with_value(65536)
|
||||
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_thin_provisioning')\
|
||||
.with_value(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'glance::backend::reserved::tasks'
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user