Add reserved stores to the sample config file

Since we know the names of the reserved stores, we can add them
to the config file to make it easier for operators to configure
these things.

Includes deprecation of the 'work_dir' and 'node_staging_uri'
options.

Change-Id: I992cf468f9ce156ba51b1dd025459939acd8dce0
This commit is contained in:
Brian Rosmaita 2019-08-05 16:55:22 -04:00
parent 733095a899
commit 4265e61bc8
5 changed files with 177 additions and 1 deletions

View File

@ -2,6 +2,7 @@
wrap_width = 80
output_file = etc/glance-api.conf.sample
namespace = glance.api
namespace = glance.reserved_stores
namespace = glance.store
namespace = glance.multi_store
namespace = oslo.concurrency

View File

@ -2,7 +2,9 @@
wrap_width = 80
output_file = etc/glance-scrubber.conf.sample
namespace = glance.scrubber
namespace = glance.reserved_stores
namespace = glance.store
namespace = glance.multi_store
namespace = oslo.concurrency
namespace = oslo.db
namespace = oslo.db.concurrency

View File

@ -17,9 +17,11 @@
Routines for configuring Glance
"""
import copy
import logging
import os
from glance_store._drivers.filesystem import _FILESYSTEM_CONFIGS as fs_cfg
from oslo_config import cfg
from oslo_middleware import cors
from oslo_policy import policy
@ -127,6 +129,16 @@ Related Options:
""")),
cfg.StrOpt('work_dir',
sample_default='/work_dir',
deprecated_for_removal=True,
deprecated_since="Train",
deprecated_reason=_("""
With the introduction of the Glance multistore feature, it is
no longer necessary to reserve a local directory for the tasks
workspace. Instead, a more flexible filesystem store can be used.
This option is scheduled to be removed early in the 'U' development
cycle.
"""),
help=_("""
Absolute path to the work directory to use for asynchronous
task operations.
@ -148,12 +160,17 @@ image conversion is enabled. All this being said, remember these
are just estimations and you should do them based on the worst
case scenario and be prepared to act in case they were wrong.
NOTE: If you are using the Glance multistore feature, you *must*
use a filesystem store instead of this setting. See the
``[os_glance_tasks_store]`` section of this configuration file
for more information.
Possible values:
* String value representing the absolute path to the working
directory
Related Options:
* None
* enabled_backends
""")),
]
@ -655,6 +672,17 @@ Relation options:
""")),
cfg.StrOpt('node_staging_uri',
deprecated_for_removal=True,
deprecated_since="Train",
deprecated_reason=_("""
With the introduction of the Glance multistore feature, it is
no longer necessary to reserve a local directory for the temporary
image staging area. Instead, a more flexible filesystem store can
be used.
This option is scheduled to be removed early in the 'U' development
cycle.
"""),
default='file:///tmp/staging/',
help=_("""
The URL provides location where the temporary data will be stored
@ -673,11 +701,17 @@ api_image_import flow will support for now.
NOTE: The staging path must be on shared filesystem available to all
Glance API nodes.
NOTE: If you are using the Glance multistore feature, you *must*
use a filesystem store instead of this setting. See the
``[os_glance_staging_store]`` section of this configuration file
for more information.
Possible values:
* String starting with 'file://' followed by absolute FS path
Related options:
* [task]/work_dir
* enabled_backends
""")),
cfg.ListOpt('enabled_import_methods',
@ -693,10 +727,137 @@ Related options:
* [DEFAULT]/node_staging_uri""")),
]
staging_store_group = cfg.OptGroup(
name='os_glance_staging_store',
help=("""
This is the configuration block for a store reserved for Glance's
internal use.
When the Glance multistore feature is in use, as indicated by the
configuration option ``[DEFAULT]/enabled_backends`` having been
configured, you must configure a *filesystem store* as the "staging
area" for the interoperable image import process. Please see the
Glance Train release notes and the "Multi Store Support" chapter of
the Glance Administration Guide for more information.
NOTE: Configuring this store replaces the use of the old
``[DEFAULT]/node_staging_uri`` option. Keep in mind, however, that the
reserved store you configure in this section of the configuration file
is *ignored* unless the Glance multistore feature is configured.
Related Options:
* [DEFAULT]/enabled_backends - NOTE: ``enabled_backends`` must have
a value (that's how the multistore feature is enabled), but the
list of backends must NOT include this reserved store
"""))
staging_store_opts = [
cfg.StrOpt('filesystem_store_datadir',
sample_default='/var/lib/glance/staging/',
help=_("""
Absolute path to the work directory to use as the staging area
for the interoperable image import process.
NOTE: When providing a value for this option, please make sure
that enough space is provided for concurrent user image import operations.
A rough estimation can be done by multiplying the expected number of
concurrent image imports with an average image size (e.g 500MB). (A
worst case scenario for concurrent uploads would be ``[DEFAULT]/workers``,
in which every available API thread is satisfying a PUT request to the
staging area.) The size estimation should be done based on the average
size image in your deployment.
Possible values:
* String value representing the absolute path to a directory
to be used by a filesystem store
* This value MUST be different from the value used for the
``[os_glance_tasks_store]/filesystem_store_datadir`` option
Related Options:
* [os_glance_tasks_store]/filesystem_store_datadir
""")),
]
# TODO(rosmaita): when we eliminate the filesystem-only requirement
# for the reserved stores, do this in a way that doesn't rely on using
# a private var of a third-party library (may require exposing a more
# convenient list options function on the glance_store side)
staging_store_opts.extend([copy.deepcopy(opt) for opt in fs_cfg
if opt.name != 'filesystem_store_datadir'])
tasks_store_group = cfg.OptGroup(
name='os_glance_tasks_store',
help=("""
This is the configuration block for a store reserved for Glance's
internal use.
When the Glance multistore feature is in use, as indicated by the
configuration option ``[DEFAULT]/enabled_backends`` having been
configured, you must configure a *filesystem store* for the use of
the tasks engine. Please see the Glance Train release notes
and the "Multi Store Support" chapter of the Glance Administration
Guide for more information.
NOTE: Configuring this store replaces the use of the old
``[tasks]/work_dir`` option. Keep in mind, however, that
the reserved store you configure in this section of the configuration
file is *ignored* unless the Glance multistore feature is configured.
Related Options:
* [DEFAULT]/enabled_backends - NOTE: ``enabled_backends`` must have
a value (that's how the multistore feature is enabled), but the
list of backends must NOT include this reserved store
"""))
tasks_store_opts = [
cfg.StrOpt('filesystem_store_datadir',
sample_default='/var/lib/glance/tasks_work_dir/',
help=_("""
Absolute path to the work directory to use for asynchronous
task operations.
NOTE: When providing a value for this option, please make sure
that enough space is provided for concurrent tasks to run
efficiently without running out of space.
A rough estimation can be done by multiplying the number of
``[taskflow_executor]/max_workers`` with an average image size
(e.g 500MB). The image size estimation should be done based on
the average size in your deployment. Note that depending on the
tasks running you may need to multiply this number by some factor
depending on what the task does. For example, you may want to double
the available size if image conversion is enabled. All this being said,
remember these are just estimations and you should do them based on
the worst case scenario and be prepared to act in case they were wrong.
Possible values:
* String value representing the absolute path to a directory
to be used by a filesystem store
* This value MUST be different from the value used for the
``[os_glance_staging_store]/filesystem_store_datadir`` option
Related Options:
* [taskflow_executor]/max_workers
* [os_glance_staging_store]/filesystem_store_datadir
""")),
]
# TODO(rosmaita): eliminate dependency on private var of 3rd party lib
tasks_store_opts.extend([copy.deepcopy(opt) for opt in fs_cfg
if opt.name != 'filesystem_store_datadir'])
CONF = cfg.CONF
CONF.register_opts(paste_deploy_opts, group='paste_deploy')
CONF.register_opts(image_format_opts, group='image_format')
CONF.register_opts(task_opts, group='task')
CONF.register_group(staging_store_group)
CONF.register_opts(staging_store_opts, group=staging_store_group)
CONF.register_group(tasks_store_group)
CONF.register_opts(tasks_store_opts, group=tasks_store_group)
CONF.register_opts(common_opts)
policy.Enforcer(CONF)

View File

@ -115,6 +115,12 @@ _image_import_opts = [
('import_filtering_opts',
glance.async_.flows._internal_plugins.import_filtering_opts),
]
_reserved_store_opts = [
(glance.common.config.staging_store_group,
glance.common.config.staging_store_opts),
(glance.common.config.tasks_store_group,
glance.common.config.tasks_store_opts),
]
def list_api_opts():
@ -169,3 +175,8 @@ def list_image_import_opts():
opts = copy.deepcopy(_image_import_opts)
opts.extend(plugin_opts.get_plugin_opts())
return [(g, copy.deepcopy(o)) for g, o in opts]
def list_reserved_store_opts():
"""Return list of oslo_config options required for the reserved stores."""
return [(g, copy.deepcopy(o)) for g, o in _reserved_store_opts]

View File

@ -52,6 +52,7 @@ glance.common.image_location_strategy.modules =
oslo.config.opts =
glance.api = glance.opts:list_api_opts
glance.registry = glance.opts:list_registry_opts
glance.reserved_stores = glance.opts:list_reserved_store_opts
glance.scrubber = glance.opts:list_scrubber_opts
glance.cache= glance.opts:list_cache_opts
glance.manage = glance.opts:list_manage_opts