Support os-brick specific lock_path

As a new feature, os-brick now supports setting the location of file
locks in a different location from the locks of the service.

The functionality is intended for HCI deployments and hosts that are
running Cinder and Glance using Cinder backend.  In those scenarios the
service can use a service specific location for its file locks while
only sharing the location of os-brick with the other services.

To leverage this functionality the new os-brick code is needed and
method ``os_brick.setup`` needs to be called once the service
configuration options have been loaded.

The default value of the os-brick ``lock_path`` is the one set in
``oslo_concurrency``.

This patch adds support for this new feature in a non backward
compatible way, so it requires an os-brick version bump in the
requirements.

The patch also ensures that ``tox -egenconfig`` includes the os-brick
configuration options when generating the sample config.

Change-Id: I9f3e46c262f5b2b72fed5a4927165b3834a1c383
This commit is contained in:
Gorka Eguileor 2022-07-07 16:22:02 +02:00 committed by Rajat Dhasmana
parent a2deecef89
commit ecefc7d67a
5 changed files with 18 additions and 1 deletions

View File

@ -34,6 +34,7 @@ import __original_module_threading as orig_threading # pylint: disable=E0401
import threading # noqa import threading # noqa
orig_threading.current_thread.__globals__['_active'] = threading._active orig_threading.current_thread.__globals__['_active'] = threading._active
import os_brick
from oslo_concurrency import processutils from oslo_concurrency import processutils
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
@ -108,6 +109,7 @@ def main():
priv_context.init(root_helper=shlex.split(utils.get_root_helper())) priv_context.init(root_helper=shlex.split(utils.get_root_helper()))
utils.monkey_patch() utils.monkey_patch()
gmr.TextGuruMeditation.setup_autorun(version, conf=CONF) gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
os_brick.setup(CONF)
global LOG global LOG
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
semaphore = utils.semaphore_factory(CONF.backup_max_operations, semaphore = utils.semaphore_factory(CONF.backup_max_operations,

View File

@ -40,6 +40,7 @@ import __original_module_threading as orig_threading # pylint: disable=E0401
import threading # noqa import threading # noqa
orig_threading.current_thread.__globals__['_active'] = threading._active orig_threading.current_thread.__globals__['_active'] = threading._active
import os_brick
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_privsep import priv_context from oslo_privsep import priv_context
@ -178,6 +179,7 @@ def main():
priv_context.init(root_helper=shlex.split(utils.get_root_helper())) priv_context.init(root_helper=shlex.split(utils.get_root_helper()))
utils.monkey_patch() utils.monkey_patch()
gmr.TextGuruMeditation.setup_autorun(version, conf=CONF) gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
os_brick.setup(CONF)
global LOG global LOG
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -0,0 +1,12 @@
---
features:
- |
os-brick file lock location can be specified independently of the Cinder
service lock location using ``lock_path`` in the ``[os_brick]``
configuration section. Useful for HCI deployments and when running Cinder
and Glance with Cinder backend on the same host.
upgrade:
- |
On HCI deployments and when running Cinder and Glance with Cinder backend
on the same host an os-brick shared location can be configured using the
``lock_path`` in the ``[os_brick]`` configuration section.

View File

@ -56,7 +56,7 @@ tenacity>=6.3.1 # Apache-2.0
WebOb>=1.8.6 # MIT WebOb>=1.8.6 # MIT
oslo.i18n>=5.1.0 # Apache-2.0 oslo.i18n>=5.1.0 # Apache-2.0
oslo.vmware>=3.10.0 # Apache-2.0 oslo.vmware>=3.10.0 # Apache-2.0
os-brick>=5.2.0 # Apache-2.0 os-brick>=6.0.0 # Apache-2.0
os-win>=5.5.0 # Apache-2.0 os-win>=5.5.0 # Apache-2.0
tooz>=2.7.1 # Apache-2.0 tooz>=2.7.1 # Apache-2.0
google-api-python-client>=1.11.0 # Apache-2.0 google-api-python-client>=1.11.0 # Apache-2.0

View File

@ -19,3 +19,4 @@ namespace = oslo.service.service
namespace = oslo.service.sslutils namespace = oslo.service.sslutils
namespace = oslo.service.wsgi namespace = oslo.service.wsgi
namespace = oslo.versionedobjects namespace = oslo.versionedobjects
namespace = os_brick