Coverage for nova/conf/imagecache.py: 89%
9 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-04-24 11:16 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-04-24 11:16 +0000
1# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
13from oslo_config import cfg
15imagecache_group = cfg.OptGroup(
16 'image_cache',
17 title='Image Cache Options',
18 help="""
19A collection of options specific to image caching.
20""")
21imagecache_opts = [
22 cfg.IntOpt('manager_interval',
23 default=2400,
24 min=-1,
25 deprecated_name='image_cache_manager_interval',
26 deprecated_group='DEFAULT',
27 help="""
28Number of seconds to wait between runs of the image cache manager.
30Note that when using shared storage for the ``[DEFAULT]/instances_path``
31configuration option across multiple nova-compute services, this periodic
32could process a large number of instances. Similarly, using a compute driver
33that manages a cluster (like vmwareapi.VMwareVCDriver) could result in
34processing a large number of instances. Therefore you may need to adjust the
35time interval for the anticipated load, or only run on one nova-compute
36service within a shared storage aggregate.
37Additional note, every time the image_cache_manager runs the timestamps
38of images in ``[DEFAULT]/instances_path`` are updated.
40Possible values:
42* 0: run at the default interval of 60 seconds (not recommended)
43* -1: disable
44* Any other value
46Related options:
48* ``[DEFAULT]/compute_driver``
49* ``[DEFAULT]/instances_path``
50"""),
51 cfg.StrOpt('subdirectory_name',
52 default='_base',
53 deprecated_name='image_cache_subdirectory_name',
54 deprecated_group='DEFAULT',
55 help="""
56Location of cached images.
58This is NOT the full path - just a folder name relative to '$instances_path'.
59For per-compute-host cached images, set to '_base_$my_ip'
60"""),
61 cfg.BoolOpt('remove_unused_base_images',
62 default=True,
63 deprecated_group='DEFAULT',
64 help="""
65Should unused base images be removed?
67When there are no remaining instances on the hypervisor created from
68this base image or linked to it, the base image is considered unused.
69"""),
70 cfg.IntOpt('remove_unused_original_minimum_age_seconds',
71 default=(24 * 3600),
72 deprecated_group='DEFAULT',
73 help="""
74Unused unresized base images younger than this will not be removed.
75"""),
76 cfg.IntOpt('remove_unused_resized_minimum_age_seconds',
77 default=3600,
78 deprecated_group='libvirt',
79 help="""
80Unused resized base images younger than this will not be removed.
81"""),
82 cfg.IntOpt('precache_concurrency',
83 default=1,
84 min=1,
85 help="""
86Maximum number of compute hosts to trigger image precaching in parallel.
88When an image precache request is made, compute nodes will be contacted
89to initiate the download. This number constrains the number of those that
90will happen in parallel. Higher numbers will cause more computes to work
91in parallel and may result in reduced time to complete the operation, but
92may also DDoS the image service. Lower numbers will result in more sequential
93operation, lower image service load, but likely longer runtime to completion.
94"""),
95]
98ALL_OPTS = (imagecache_opts,)
101def register_opts(conf):
102 conf.register_group(imagecache_group)
103 conf.register_opts(imagecache_opts, group=imagecache_group)
106def list_opts():
107 return {imagecache_group: imagecache_opts}