Merge "Add parameters for image copy when using multiple RBD Glance stores"

This commit is contained in:
Zuul 2021-07-03 19:06:51 +00:00 committed by Gerrit Code Review
commit 54c2c9658e
3 changed files with 67 additions and 23 deletions

View File

@ -30,6 +30,23 @@
# (optional) The path to the ceph configuration file to use.
# Defaults to '/etc/ceph/ceph.conf'.
#
# [*libvirt_images_rbd_glance_store_name*]
# (optional) Name of the Glance store that represents the local rbd cluster.
# If set, this will allow Nova to request that Glance copy an image from
# an existing non-local store into the one named by this option before
# booting so that proper Copy-on-Write behavior is maintained.
# Defaults to $::os_service_default.
#
# [*libvirt_images_rbd_glance_copy_poll_interval*]
# (optional) The interval in seconds with which to poll Glance after asking
# for it to copy an image to the local rbd store.
# Defaults to $::os_service_default.
#
# [*libvirt_images_rbd_glance_copy_timeout*]
# (optional) The overall maximum time we will wait for Glance to complete
# an image copy to our local rbd store.
# Defaults to $::os_service_default.
#
# [*libvirt_rbd_user*]
# (Required) The RADOS client name for accessing rbd volumes.
#
@ -62,16 +79,20 @@
# (optional) Ensure value for ceph client package.
# Defaults to 'present'.
class nova::compute::rbd (
$libvirt_rbd_user,
$libvirt_rbd_secret_uuid = false,
$libvirt_rbd_secret_key = undef,
$libvirt_images_rbd_pool = 'rbd',
$libvirt_images_rbd_ceph_conf = '/etc/ceph/ceph.conf',
$rbd_keyring = 'client.nova',
$ephemeral_storage = true,
$manage_ceph_client = true,
$ceph_client_ensure = 'present',
$libvirt_rbd_secret_uuid = false,
$libvirt_rbd_secret_key = undef,
$libvirt_images_rbd_pool = 'rbd',
$libvirt_images_rbd_ceph_conf = '/etc/ceph/ceph.conf',
$libvirt_images_rbd_glance_store_name = $::os_service_default,
$libvirt_images_rbd_glance_copy_poll_interval = $::os_service_default,
$libvirt_images_rbd_glance_copy_timeout = $::os_service_default,
$rbd_keyring = 'client.nova',
$ephemeral_storage = true,
$manage_ceph_client = true,
$ceph_client_ensure = 'present',
) {
include nova::deps
@ -150,13 +171,20 @@ class nova::compute::rbd (
}
nova_config {
'libvirt/images_rbd_pool': value => $libvirt_images_rbd_pool;
'libvirt/images_rbd_ceph_conf': value => $libvirt_images_rbd_ceph_conf;
'libvirt/images_rbd_pool': value => $libvirt_images_rbd_pool;
'libvirt/images_rbd_ceph_conf': value => $libvirt_images_rbd_ceph_conf;
'libvirt/images_rbd_glance_store_name': value => $libvirt_images_rbd_glance_store_name;
'libvirt/images_rbd_glance_copy_poll_interval': value => $libvirt_images_rbd_glance_copy_poll_interval;
'libvirt/images_rbd_glance_copy_timeout': value => $libvirt_images_rbd_glance_copy_timeout;
}
} else {
nova_config {
'libvirt/images_rbd_pool': ensure => absent;
'libvirt/images_rbd_ceph_conf': ensure => absent;
'libvirt/images_rbd_pool': ensure => absent;
'libvirt/images_rbd_ceph_conf': ensure => absent;
'libvirt/images_rbd_glance_store_name': ensure => absent;
'libvirt/images_rbd_glance_copy_poll_interval': ensure => absent;
'libvirt/images_rbd_glance_copy_timeout': ensure => absent;
}
}

View File

@ -0,0 +1,8 @@
---
features:
- |
Add parameters for Nova/Glance image copy when using multiple RBD Glance stores.
- ``nova::compute::rbd::libvirt_images_rbd_glance_store_name``
- ``nova::compute::rbd::libvirt_images_rbd_glance_copy_poll_interval``
- ``nova::compute::rbd::libvirt_images_rbd_glance_copy_timeout``

View File

@ -23,11 +23,7 @@ require 'spec_helper'
describe 'nova::compute::rbd' do
let :params do
{ :libvirt_rbd_user => 'nova',
:libvirt_rbd_secret_uuid => false,
:libvirt_images_rbd_pool => 'rbd',
:libvirt_images_rbd_ceph_conf => '/etc/ceph/ceph.conf',
:ephemeral_storage => true }
{ :libvirt_rbd_user => 'nova' }
end
shared_examples_for 'nova compute rbd' do
@ -38,6 +34,9 @@ describe 'nova::compute::rbd' do
is_expected.to contain_nova_config('libvirt/images_rbd_pool').with_value('rbd')
is_expected.to contain_nova_config('libvirt/images_rbd_ceph_conf').with_value('/etc/ceph/ceph.conf')
is_expected.to contain_nova_config('libvirt/rbd_user').with_value('nova')
is_expected.to contain_nova_config('libvirt/images_rbd_glance_store_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('libvirt/images_rbd_glance_copy_poll_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('libvirt/images_rbd_glance_copy_timeout').with_value('<SERVICE DEFAULT>')
end
it 'installs client package' do
@ -50,10 +49,13 @@ describe 'nova::compute::rbd' do
context 'when overriding default parameters' do
before :each do
params.merge!(
:libvirt_rbd_user => 'joe',
:libvirt_rbd_secret_uuid => false,
:libvirt_images_rbd_pool => 'AnotherPool',
:libvirt_images_rbd_ceph_conf => '/tmp/ceph.conf'
:libvirt_rbd_user => 'joe',
:libvirt_rbd_secret_uuid => false,
:libvirt_images_rbd_pool => 'AnotherPool',
:libvirt_images_rbd_ceph_conf => '/tmp/ceph.conf',
:libvirt_images_rbd_glance_store_name => 'glance_rbd_store',
:libvirt_images_rbd_glance_copy_poll_interval => 30,
:libvirt_images_rbd_glance_copy_timeout => 300
)
end
@ -61,6 +63,9 @@ describe 'nova::compute::rbd' do
is_expected.to contain_nova_config('libvirt/images_rbd_pool').with_value('AnotherPool')
is_expected.to contain_nova_config('libvirt/images_rbd_ceph_conf').with_value('/tmp/ceph.conf')
is_expected.to contain_nova_config('libvirt/rbd_user').with_value('joe')
is_expected.to contain_nova_config('libvirt/images_rbd_glance_store_name').with_value('glance_rbd_store')
is_expected.to contain_nova_config('libvirt/images_rbd_glance_copy_poll_interval').with_value(30)
is_expected.to contain_nova_config('libvirt/images_rbd_glance_copy_timeout').with_value(300)
end
end
@ -121,8 +126,11 @@ describe 'nova::compute::rbd' do
end
it 'should only set user and secret_uuid in nova.conf ' do
is_expected.to_not contain_nova_config('libvirt/images_rbd_pool').with_value('rbd')
is_expected.to_not contain_nova_config('libvirt/images_rbd_ceph_conf').with_value('/etc/ceph/ceph.conf')
is_expected.to contain_nova_config('libvirt/images_rbd_pool').with_ensure('absent')
is_expected.to contain_nova_config('libvirt/images_rbd_ceph_conf').with_ensure('absent')
is_expected.to contain_nova_config('libvirt/images_rbd_glance_store_name').with_ensure('absent')
is_expected.to contain_nova_config('libvirt/images_rbd_glance_copy_poll_interval').with_ensure('absent')
is_expected.to contain_nova_config('libvirt/images_rbd_glance_copy_timeout').with_ensure('absent')
is_expected.to contain_nova_config('libvirt/rbd_user').with_value('nova')
is_expected.to contain_nova_config('libvirt/rbd_secret_uuid').with_value('UUID')
end