rbd: Support more libvirt driver tunables

Change-Id: I797141ce37129cc1b42da4182a4c54439c1371d1
This commit is contained in:
Takashi Kajinami 2024-04-27 17:18:08 +09:00
parent dd59f94f57
commit a809ded22e
3 changed files with 70 additions and 27 deletions

View File

@ -22,6 +22,21 @@
#
# === Parameters
#
# [*libvirt_rbd_user*]
# (Required) The RADOS client name for accessing rbd volumes.
#
# [*libvirt_rbd_secret_uuid*]
# (optional) The libvirt uuid of the secret for the rbd_user.
# Required to use cephx.
# Default to undef.
#
# [*libvirt_rbd_secret_key*]
# (optional) The cephx key to use as key for the libvirt secret,
# it must be base64 encoded; when not provided this key will be
# requested to the ceph cluster, which assumes the node is
# provided of the client.admin keyring as well.
# Default to undef.
#
# [*libvirt_images_rbd_pool*]
# (optional) The RADOS pool in which rbd volumes are stored.
# Defaults to 'rbd'.
@ -47,20 +62,19 @@
# an image copy to our local rbd store.
# Defaults to $facts['os_service_default'].
#
# [*libvirt_rbd_user*]
# (Required) The RADOS client name for accessing rbd volumes.
# [*libvirt_rbd_connect_timeout*]
# (optional) The RADOS client timeout in seconds when initially connecting
# to the cluster.
# Defaults to $facts['os_service_default'].
#
# [*libvirt_rbd_secret_uuid*]
# (optional) The libvirt uuid of the secret for the rbd_user.
# Required to use cephx.
# Default to undef.
# [*libvirt_rbd_destroy_volume_retry_interval*]
# (optional) Number of seconds to wait between each consecutive retry to
# destroy a RBD volume.
# Defaults to $facts['os_service_default'].
#
# [*libvirt_rbd_secret_key*]
# (optional) The cephx key to use as key for the libvirt secret,
# it must be base64 encoded; when not provided this key will be
# requested to the ceph cluster, which assumes the node is
# provided of the client.admin keyring as well.
# Default to undef.
# [*libvirt_rbd_destroy_volume_retries*]
# (optional) Number of retries to destory a RBD volume.
# Defaults to $facts['os_service_default'].
#
# [*ephemeral_storage*]
# (optional) Whether or not to use the rbd driver for the nova
@ -99,6 +113,9 @@ class nova::compute::rbd (
$libvirt_images_rbd_glance_store_name = $facts['os_service_default'],
$libvirt_images_rbd_glance_copy_poll_interval = $facts['os_service_default'],
$libvirt_images_rbd_glance_copy_timeout = $facts['os_service_default'],
$libvirt_rbd_connect_timeout = $facts['os_service_default'],
$libvirt_rbd_destroy_volume_retry_interval = $facts['os_service_default'],
$libvirt_rbd_destroy_volume_retries = $facts['os_service_default'],
Boolean $ephemeral_storage = true,
Boolean $manage_ceph_client = true,
$ceph_client_ensure = 'present',
@ -177,7 +194,9 @@ class nova::compute::rbd (
'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;
'libvirt/rbd_connect_timeout': value => $libvirt_rbd_connect_timeout;
'libvirt/rbd_destroy_volume_retry_interval': value => $libvirt_rbd_destroy_volume_retry_interval;
'libvirt/rbd_destroy_volume_retries': value => $libvirt_rbd_destroy_volume_retries;
}
} else {
nova_config {
@ -186,6 +205,9 @@ class nova::compute::rbd (
'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;
'libvirt/rbd_connect_timeout': ensure => absent;
'libvirt/rbd_destroy_volume_retry_interval': ensure => absent;
'libvirt/rbd_destroy_volume_retries': ensure => absent;
}
}

View File

@ -0,0 +1,9 @@
---
features:
- |
The following parameters have been added to the ``nova::compute::rbd``
class.
- ``libvirt_rbd_connect_timeout``
- ``libvirt_rbd_destroy_volume_retry_interval``
- ``rbd_destroy_volume_retries``

View File

@ -38,6 +38,9 @@ describe 'nova::compute::rbd' do
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>')
is_expected.to contain_nova_config('libvirt/rbd_connect_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('libvirt/rbd_destroy_volume_retry_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('libvirt/rbd_destroy_volume_retries').with_value('<SERVICE DEFAULT>')
end
it 'installs client package' do
@ -56,17 +59,23 @@ describe 'nova::compute::rbd' do
: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
:libvirt_images_rbd_glance_copy_timeout => 300,
:libvirt_rbd_connect_timeout => 5,
:libvirt_rbd_destroy_volume_retry_interval => 5,
:libvirt_rbd_destroy_volume_retries => 12,
)
end
it 'configure nova.conf with overridden parameters' 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)
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)
is_expected.to contain_nova_config('libvirt/rbd_connect_timeout').with_value(5)
is_expected.to contain_nova_config('libvirt/rbd_destroy_volume_retry_interval').with_value(5)
is_expected.to contain_nova_config('libvirt/rbd_destroy_volume_retries').with_value(12)
end
end
@ -94,13 +103,16 @@ describe 'nova::compute::rbd' do
end
it 'should only set user and secret_uuid in nova.conf ' do
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')
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_connect_timeout').with_ensure('absent')
is_expected.to contain_nova_config('libvirt/rbd_destroy_volume_retry_interval').with_ensure('absent')
is_expected.to contain_nova_config('libvirt/rbd_destroy_volume_retries').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
it { is_expected.to contain_nova__compute__libvirt__secret_ceph('UUID').with(