Add support for image download via rbd

This change introduces some new parameters to the nova::glance class,
which are required for the new feature to download glance image via
RBD instead of API[1].

[1] https://review.opendev.org/c/openstack/nova/+/574301

Change-Id: I0c9ebc5fd980204c59cc903372820e1ee1245630
This commit is contained in:
Takashi Kajinami 2021-01-14 09:48:36 +09:00
parent 6b99fa975e
commit 896bf1ff5e
3 changed files with 59 additions and 6 deletions

View File

@ -12,9 +12,37 @@
# (optional) Number of retries in glance operation
# Defaults to $::os_service_default
#
# [*enable_rbd_download*]
# (optional) Enable download of Glance images directly via RBD
# Defaults to $::os_service_default
#
# [*rbd_user*]
# (optional) The RADOS client name for accessing Glance images stored as
# rbd volumes.
# Defaults to $::os_service_default
#
# [*rbd_connect_timeout*]
# (optional) THe RADOS client timeout in seconds when initially connecting
# to the cluster.
# Defaults to $::os_service_default
#
# [*rbd_pool*]
# (optional) The RADOS pool in which the Glance images are stored as rbd
# volumes.
# Defaults to $::os_service_default
#
# [*rbd_ceph_conf*]
# (optional) Path to the ceph configuration file to use.
# Defaults to $::os_service_default
#
class nova::glance (
$endpoint_override = $::os_service_default,
$num_retries = $::os_service_default,
$endpoint_override = $::os_service_default,
$num_retries = $::os_service_default,
$enable_rbd_download = $::os_service_default,
$rbd_user = $::os_service_default,
$rbd_connect_timeout = $::os_service_default,
$rbd_pool = $::os_service_default,
$rbd_ceph_conf = $::os_service_default,
) {
include nova::deps
@ -23,7 +51,12 @@ class nova::glance (
$num_retries_real = pick($::nova::glance_num_retries, $num_retries)
nova_config {
'glance/endpoint_override': value => $endpoint_override_real;
'glance/num_retries': value => $num_retries_real;
'glance/endpoint_override': value => $endpoint_override_real;
'glance/num_retries': value => $num_retries_real;
'glance/enable_rbd_download': value => $enable_rbd_download;
'glance/rbd_user': value => $rbd_user;
'glance/rbd_connect_timeout': value => $rbd_connect_timeout;
'glance/rbd_pool': value => $rbd_pool;
'glance/rbd_ceph_conf': value => $rbd_ceph_conf;
}
}

View File

@ -0,0 +1,5 @@
---
features:
- |
Now puppet-nova supports configurations required to download Glance images
into the libvirt image cache via RBD.

View File

@ -11,20 +11,35 @@ describe 'nova::glance' do
it 'configure default params' do
is_expected.to contain_nova_config('glance/endpoint_override').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('glance/num_retries').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('glance/enable_rbd_download').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('glance/rbd_user').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('glance/rbd_connect_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('glance/rbd_pool').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('glance/rbd_ceph_conf').with_value('<SERVICE DEFAULT>')
end
end
context 'with specific parameters' do
let :params do
{
:endpoint_override => 'http://localhost:9292',
:num_retries => 3,
:endpoint_override => 'http://localhost:9292',
:num_retries => 3,
:enable_rbd_download => true,
:rbd_user => 'nova',
:rbd_connect_timeout => 5,
:rbd_pool => 'images',
:rbd_ceph_conf => '/etc/ceph/ceph.conf',
}
end
it 'configure glance params' do
is_expected.to contain_nova_config('glance/endpoint_override').with_value('http://localhost:9292')
is_expected.to contain_nova_config('glance/num_retries').with_value(3)
is_expected.to contain_nova_config('glance/enable_rbd_download').with_value(true)
is_expected.to contain_nova_config('glance/rbd_user').with_value('nova')
is_expected.to contain_nova_config('glance/rbd_connect_timeout').with_value(5)
is_expected.to contain_nova_config('glance/rbd_pool').with_value('images')
is_expected.to contain_nova_config('glance/rbd_ceph_conf').with_value('/etc/ceph/ceph.conf')
end
end
end