Configure rados_connect_timeout parameter in glance config

This patch adds new config option for rados connect timeout,
which tells how much time glance-api  has to  wait before
close the connection.

Setting 'rados_connect_timeout' <= 0  means no timeout.

Upstream change-id: I2352bdec2a3339785eb38249afe385c5e496457c

Closes-Bug:#1459743

Change-Id: Ie4435a6bae56e8e6c1192ab66c83aa72a6b76305
This commit is contained in:
Maksym Yatsenko 2015-08-28 22:54:49 +03:00
parent 36dd5a798e
commit d209be85da
5 changed files with 28 additions and 7 deletions

View File

@ -26,6 +26,11 @@
# accepts latest or specific versions.
# Defaults to present.
#
# [*rados_connect_timeout*]
# Optinal. Timeout value (in seconds) used when connecting
# to ceph cluster. If value <= 0, no timeout is set and
# default librados value is used.
#
class glance::backend::rbd(
$rbd_store_user = undef,
@ -34,6 +39,7 @@ class glance::backend::rbd(
$rbd_store_chunk_size = '8',
$show_image_direct_url = undef,
$package_ensure = 'present',
$rados_connect_timeout = '0',
) {
include ::glance::params
@ -42,11 +48,12 @@ class glance::backend::rbd(
}
glance_api_config {
'glance_store/default_store': value => 'rbd';
'glance_store/rbd_store_ceph_conf': value => $rbd_store_ceph_conf;
'glance_store/rbd_store_user': value => $rbd_store_user;
'glance_store/rbd_store_pool': value => $rbd_store_pool;
'glance_store/rbd_store_chunk_size': value => $rbd_store_chunk_size;
'glance_store/default_store': value => 'rbd';
'glance_store/rbd_store_ceph_conf': value => $rbd_store_ceph_conf;
'glance_store/rbd_store_user': value => $rbd_store_user;
'glance_store/rbd_store_pool': value => $rbd_store_pool;
'glance_store/rbd_store_chunk_size': value => $rbd_store_chunk_size;
'glance_store/rados_connect_timeout': value => $rados_connect_timeout;
}
package { 'python-ceph':

View File

@ -18,6 +18,7 @@ describe 'glance::backend::rbd' do
it { is_expected.to contain_glance_api_config('glance_store/rbd_store_pool').with_value('images') }
it { is_expected.to contain_glance_api_config('glance_store/rbd_store_ceph_conf').with_value('/etc/ceph/ceph.conf') }
it { is_expected.to contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('8') }
it { is_expected.to contain_glance_api_config('glance_store/rados_connect_timeout').with_value('0') }
it { is_expected.to contain_package('python-ceph').with(
:name => 'python-ceph',
@ -32,10 +33,12 @@ describe 'glance::backend::rbd' do
:rbd_store_user => 'user',
:rbd_store_chunk_size => '2',
:package_ensure => 'latest',
:rados_connect_timeout => '30',
}
end
it { is_expected.to contain_glance_api_config('glance_store/rbd_store_user').with_value('user') }
it { is_expected.to contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('2') }
it { is_expected.to contain_glance_api_config('glance_store/rados_connect_timeout').with_value('30') }
it { is_expected.to contain_package('python-ceph').with(
:name => 'python-ceph',
:ensure => 'latest'

View File

@ -87,6 +87,7 @@ class openstack::glance (
$known_stores = false,
$rbd_store_user = 'images',
$rbd_store_pool = 'images',
$rados_connect_timeout = '0',
$ceilometer = false,
$service_workers = $::processorcount,
) {
@ -260,8 +261,9 @@ class openstack::glance (
'rbd', 'ceph': {
Ceph::Pool<| title == $::ceph::glance_pool |> ->
class { 'glance::backend::rbd':
rbd_store_user => $rbd_store_user,
rbd_store_pool => $rbd_store_pool,
rbd_store_user => $rbd_store_user,
rbd_store_pool => $rbd_store_pool,
rados_connect_timeout => $rados_connect_timeout,
}
}
'vmware': {

View File

@ -55,6 +55,8 @@ $glance_show_image_direct_url = pick($glance_hash['show_image_direct_url'], tr
$glance_pipeline = pick($glance_hash['pipeline'], 'keystone')
$glance_large_object_size = pick($glance_hash['large_object_size'], '5120')
$rados_connect_timeout = '30'
if ($storage_hash['images_ceph']) {
$glance_backend = 'ceph'
$glance_known_stores = [ 'glance.store.rbd.Store', 'glance.store.http.Store' ]
@ -112,6 +114,7 @@ class { 'openstack::glance':
known_stores => $glance_known_stores,
ceilometer => $ceilometer_hash[enabled],
service_workers => $service_workers,
rados_connect_timeout => $rados_connect_timeout,
}
####### Disable upstart startup on install #######

View File

@ -52,6 +52,12 @@ describe manifest do
should contain_glance_api_config('DEFAULT/auth_url').with_value("#{auth_uri}v2.0/")
end
if $glance_backend == 'rbd'
it 'should configure rados_connect_timeout' do
should contain_glance_api_config('glance_store/rados_connect_timeout').with_value('30')
end
end
it 'should configure glance cache config' do
should contain_glance_cache_config('DEFAULT/use_syslog').with_value(use_syslog)
should contain_glance_cache_config('DEFAULT/image_cache_dir').with_value('/var/lib/glance/image-cache/')