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.

Conflicts:
        manifests/api.pp
        spec/classes/glance_api_spec.rb

Change-Id: I8ece28a9b0c6f104130d817490e9ea4c2b4e7808
(cherry picked from commit 24ee288b85)
(cherry picked from commit 311cb2ade5)
changes/27/731727/2
Pranali Deore 1 month ago
parent
commit
8ac5b132e3
3 changed files with 103 additions and 88 deletions
  1. +26
    -20
      manifests/api.pp
  2. +6
    -0
      releasenotes/notes/add_cache_prefetcher_interval-e77d98c5235e91bc.yaml
  3. +71
    -68
      spec/classes/glance_api_spec.rb

+ 26
- 20
manifests/api.pp View File

@@ -91,6 +91,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.
@@ -352,6 +356,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',
@@ -414,26 +419,27 @@ class glance::api(

# 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/show_multiple_locations': value => $show_multiple_locations;
'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;
'glance_store/os_region_name': value => $os_region_name;
'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/show_multiple_locations': value => $show_multiple_locations;
'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;
'glance_store/os_region_name': value => $os_region_name;
}

# task/taskflow_executor config.


+ 6
- 0
releasenotes/notes/add_cache_prefetcher_interval-e77d98c5235e91bc.yaml View File

@@ -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.

+ 71
- 68
spec/classes/glance_api_spec.rb View File

@@ -9,84 +9,86 @@ describe 'glance::api' do

let :default_params do
{
:bind_host => '<SERVICE DEFAULT>',
:bind_port => '9292',
:registry_host => '0.0.0.0',
:registry_port => '<SERVICE DEFAULT>',
:registry_client_protocol => '<SERVICE DEFAULT>',
:auth_strategy => 'keystone',
:enabled => true,
:manage_service => true,
:backlog => '<SERVICE DEFAULT>',
:workers => '7',
:show_image_direct_url => '<SERVICE DEFAULT>',
:show_multiple_locations => '<SERVICE DEFAULT>',
:bind_host => '<SERVICE DEFAULT>',
:bind_port => '9292',
:registry_host => '0.0.0.0',
:registry_port => '<SERVICE DEFAULT>',
:registry_client_protocol => '<SERVICE DEFAULT>',
:auth_strategy => 'keystone',
:enabled => true,
:manage_service => true,
:backlog => '<SERVICE DEFAULT>',
:workers => '7',
:show_image_direct_url => '<SERVICE DEFAULT>',
:show_multiple_locations => '<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>',
:os_region_name => 'RegionOne',
: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>',
:os_region_name => 'RegionOne',
: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',
:os_region_name => 'RegionOne2',
: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',
:os_region_name => 'RegionOne2',
:pipeline => 'keystone2',
:sync_db => false,
:limit_param_default => '10',
:api_limit_max => '10',
}
].each do |param_set|

@@ -137,6 +139,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