Browse Source

Add cache prefetcher interval configuration option

As new periodic job added in glance which will run as per
interval set using 'cache_prefetcher_interval' configuration
option and fetch images which are queued for caching in cache
directory.

Enabled 'cache_prefetcher_interval' configuration option
in glance-api.conf.

Change-Id: I8ece28a9b0c6f104130d817490e9ea4c2b4e7808
changes/36/729836/2
Pranali Deore 1 year ago
parent
commit
24ee288b85
  1. 42
      manifests/api.pp
  2. 6
      releasenotes/notes/add_cache_prefetcher_interval-e77d98c5235e91bc.yaml
  3. 127
      spec/classes/glance_api_spec.rb

42
manifests/api.pp

@ -75,6 +75,10 @@
# (optional) If set, use this value for max_overflow with sqlalchemy.
# Defaults to undef.
#
# [*cache_prefetcher_interval*]
# (optional) The interval in seconds to run periodic job 'cache_images'
# Defaults to $::os_service_default.
#
# [*image_cache_max_size*]
# (optional) The upper limit (the maximum size of accumulated cache in bytes) beyond which pruner,
# if running, starts cleaning the images cache.
@ -347,6 +351,7 @@ class glance::api(
$database_max_retries = undef,
$database_retry_interval = undef,
$database_max_overflow = undef,
$cache_prefetcher_interval = $::os_service_default,
$image_cache_max_size = $::os_service_default,
$image_cache_stall_time = $::os_service_default,
$image_cache_dir = '/var/lib/glance/image-cache',
@ -419,24 +424,25 @@ cinder::backend::multistore::cinder::cinder_os_region_name instead.')
# basic service config
glance_api_config {
'DEFAULT/bind_host': value => $bind_host;
'DEFAULT/bind_port': value => $bind_port;
'DEFAULT/backlog': value => $backlog;
'DEFAULT/workers': value => $workers;
'DEFAULT/show_image_direct_url': value => $show_image_direct_url;
'DEFAULT/location_strategy': value => $location_strategy;
'DEFAULT/scrub_time': value => $scrub_time;
'DEFAULT/delayed_delete': value => $delayed_delete;
'DEFAULT/image_cache_dir': value => $image_cache_dir;
'DEFAULT/image_cache_stall_time': value => $image_cache_stall_time;
'DEFAULT/image_cache_max_size': value => $image_cache_max_size;
'DEFAULT/enabled_import_methods': value => $enabled_import_methods_real;
'DEFAULT/node_staging_uri': value => $node_staging_uri;
'DEFAULT/image_member_quota': value => $image_member_quota;
'DEFAULT/enable_v1_api': value => $enable_v1_api;
'DEFAULT/enable_v2_api': value => $enable_v2_api;
'DEFAULT/limit_param_default': value => $limit_param_default;
'DEFAULT/api_limit_max': value => $api_limit_max;
'DEFAULT/bind_host': value => $bind_host;
'DEFAULT/bind_port': value => $bind_port;
'DEFAULT/backlog': value => $backlog;
'DEFAULT/workers': value => $workers;
'DEFAULT/show_image_direct_url': value => $show_image_direct_url;
'DEFAULT/location_strategy': value => $location_strategy;
'DEFAULT/scrub_time': value => $scrub_time;
'DEFAULT/delayed_delete': value => $delayed_delete;
'DEFAULT/cache_prefetcher_interval': value => $cache_prefetcher_interval;
'DEFAULT/image_cache_dir': value => $image_cache_dir;
'DEFAULT/image_cache_stall_time': value => $image_cache_stall_time;
'DEFAULT/image_cache_max_size': value => $image_cache_max_size;
'DEFAULT/enabled_import_methods': value => $enabled_import_methods_real;
'DEFAULT/node_staging_uri': value => $node_staging_uri;
'DEFAULT/image_member_quota': value => $image_member_quota;
'DEFAULT/enable_v1_api': value => $enable_v1_api;
'DEFAULT/enable_v2_api': value => $enable_v2_api;
'DEFAULT/limit_param_default': value => $limit_param_default;
'DEFAULT/api_limit_max': value => $api_limit_max;
}
if $show_multiple_locations {

6
releasenotes/notes/add_cache_prefetcher_interval-e77d98c5235e91bc.yaml

@ -0,0 +1,6 @@
---
features:
- |
Added cache_prefetcher_interval in glance-api.conf,
using which the periodic job will run as per the set
interval and prefetch images into cache.

127
spec/classes/glance_api_spec.rb

@ -9,78 +9,80 @@ describe 'glance::api' do
let :default_params do
{
:bind_host => '<SERVICE DEFAULT>',
:bind_port => '9292',
:auth_strategy => 'keystone',
:enabled => true,
:manage_service => true,
:backlog => '<SERVICE DEFAULT>',
:workers => '7',
:show_image_direct_url => '<SERVICE DEFAULT>',
:bind_host => '<SERVICE DEFAULT>',
:bind_port => '9292',
:auth_strategy => 'keystone',
:enabled => true,
:manage_service => true,
:backlog => '<SERVICE DEFAULT>',
:workers => '7',
:show_image_direct_url => '<SERVICE DEFAULT>',
:filesystem_store_metadata_file => '<SERVICE DEFAULT>',
:filesystem_store_file_perm => '<SERVICE DEFAULT>',
:location_strategy => '<SERVICE DEFAULT>',
:purge_config => false,
:delayed_delete => '<SERVICE DEFAULT>',
:scrub_time => '<SERVICE DEFAULT>',
:image_cache_dir => '/var/lib/glance/image-cache',
:image_import_plugins => '<SERVICE DEFAULT>',
:filesystem_store_file_perm => '<SERVICE DEFAULT>',
:location_strategy => '<SERVICE DEFAULT>',
:purge_config => false,
:delayed_delete => '<SERVICE DEFAULT>',
:scrub_time => '<SERVICE DEFAULT>',
:image_cache_dir => '/var/lib/glance/image-cache',
:image_import_plugins => '<SERVICE DEFAULT>',
:image_conversion_output_format => '<SERVICE DEFAULT>',
:inject_metadata_properties => '<SERVICE DEFAULT>',
:ignore_user_roles => '<SERVICE DEFAULT>',
:enabled_import_methods => '<SERVICE DEFAULT>',
:node_staging_uri => '<SERVICE DEFAULT>',
:image_member_quota => '<SERVICE DEFAULT>',
:image_cache_stall_time => '<SERVICE DEFAULT>',
:image_cache_max_size => '<SERVICE DEFAULT>',
:pipeline => 'keystone',
:task_time_to_live => '<SERVICE DEFAULT>',
:task_executor => '<SERVICE DEFAULT>',
:task_work_dir => '<SERVICE DEFAULT>',
:taskflow_engine_mode => '<SERVICE DEFAULT>',
:taskflow_max_workers => '<SERVICE DEFAULT>',
:conversion_format => '<SERVICE DEFAULT>',
:enable_v1_api => false,
:enable_v2_api => '<SERVICE DEFAULT>',
:sync_db => true,
:limit_param_default => '<SERVICE DEFAULT>',
:api_limit_max => '<SERVICE DEFAULT>',
:inject_metadata_properties => '<SERVICE DEFAULT>',
:ignore_user_roles => '<SERVICE DEFAULT>',
:enabled_import_methods => '<SERVICE DEFAULT>',
:node_staging_uri => '<SERVICE DEFAULT>',
:image_member_quota => '<SERVICE DEFAULT>',
:image_cache_stall_time => '<SERVICE DEFAULT>',
:image_cache_max_size => '<SERVICE DEFAULT>',
:cache_prefetcher_interval => '<SERVICE DEFAULT>',
:pipeline => 'keystone',
:task_time_to_live => '<SERVICE DEFAULT>',
:task_executor => '<SERVICE DEFAULT>',
:task_work_dir => '<SERVICE DEFAULT>',
:taskflow_engine_mode => '<SERVICE DEFAULT>',
:taskflow_max_workers => '<SERVICE DEFAULT>',
:conversion_format => '<SERVICE DEFAULT>',
:enable_v1_api => false,
:enable_v2_api => '<SERVICE DEFAULT>',
:sync_db => true,
:limit_param_default => '<SERVICE DEFAULT>',
:api_limit_max => '<SERVICE DEFAULT>',
}
end
shared_examples_for 'glance::api' do
[{
:bind_host => '127.0.0.1',
:bind_port => '9222',
:registry_host => '127.0.0.1',
:registry_port => '9111',
:registry_client_protocol => 'https',
:auth_strategy => 'not_keystone',
:enabled => false,
:backlog => '4095',
:workers => '5',
:show_image_direct_url => true,
:show_multiple_locations => true,
:bind_host => '127.0.0.1',
:bind_port => '9222',
:registry_host => '127.0.0.1',
:registry_port => '9111',
:registry_client_protocol => 'https',
:auth_strategy => 'not_keystone',
:enabled => false,
:backlog => '4095',
:workers => '5',
:show_image_direct_url => true,
:show_multiple_locations => true,
:filesystem_store_metadata_file => '/etc/glance/glance-metadata-file.conf',
:filesystem_store_file_perm => '0644',
:location_strategy => 'store_type',
:delayed_delete => 'true',
:scrub_time => '10',
:image_cache_dir => '/tmp/glance',
:image_import_plugins => 'image_conversion',
:filesystem_store_file_perm => '0644',
:location_strategy => 'store_type',
:delayed_delete => 'true',
:scrub_time => '10',
:image_cache_dir => '/tmp/glance',
:image_import_plugins => 'image_conversion',
:image_conversion_output_format => 'raw',
:inject_metadata_properties => 'key:val',
:ignore_user_roles => 'admin',
:enabled_import_methods => 'glance-direct,web-download',
:node_staging_uri => '/tmp/staging',
:image_member_quota => '128',
:image_cache_stall_time => '10',
:image_cache_max_size => '10737418240',
:pipeline => 'keystone2',
:sync_db => false,
:limit_param_default => '10',
:api_limit_max => '10',
:inject_metadata_properties => 'key:val',
:ignore_user_roles => 'admin',
:enabled_import_methods => 'glance-direct,web-download',
:node_staging_uri => '/tmp/staging',
:image_member_quota => '128',
:image_cache_stall_time => '10',
:image_cache_max_size => '10737418240',
:cache_prefetcher_interval => '300',
:pipeline => 'keystone2',
:sync_db => false,
:limit_param_default => '10',
:api_limit_max => '10',
}
].each do |param_set|
@ -131,6 +133,7 @@ describe 'glance::api' do
'image_cache_dir',
'image_cache_stall_time',
'image_cache_max_size',
'cache_prefetcher_interval',
'node_staging_uri',
'image_member_quota',
'enable_v1_api',

Loading…
Cancel
Save