From ecefc7d67ad3b3257e5f3f04533ea8ee1fbbcfd3 Mon Sep 17 00:00:00 2001 From: Gorka Eguileor Date: Thu, 7 Jul 2022 16:22:02 +0200 Subject: [PATCH] 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 --- cinder/cmd/backup.py | 2 ++ cinder/cmd/volume.py | 2 ++ releasenotes/notes/lock_path-940af881b2112bbe.yaml | 12 ++++++++++++ requirements.txt | 2 +- tools/config/cinder-config-generator.conf | 1 + 5 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/lock_path-940af881b2112bbe.yaml diff --git a/cinder/cmd/backup.py b/cinder/cmd/backup.py index a3381364fb7..2f10be14710 100644 --- a/cinder/cmd/backup.py +++ b/cinder/cmd/backup.py @@ -34,6 +34,7 @@ import __original_module_threading as orig_threading # pylint: disable=E0401 import threading # noqa orig_threading.current_thread.__globals__['_active'] = threading._active +import os_brick from oslo_concurrency import processutils from oslo_config import cfg from oslo_log import log as logging @@ -108,6 +109,7 @@ def main(): priv_context.init(root_helper=shlex.split(utils.get_root_helper())) utils.monkey_patch() gmr.TextGuruMeditation.setup_autorun(version, conf=CONF) + os_brick.setup(CONF) global LOG LOG = logging.getLogger(__name__) semaphore = utils.semaphore_factory(CONF.backup_max_operations, diff --git a/cinder/cmd/volume.py b/cinder/cmd/volume.py index 4fae53d3e57..508bc6c07e3 100644 --- a/cinder/cmd/volume.py +++ b/cinder/cmd/volume.py @@ -40,6 +40,7 @@ import __original_module_threading as orig_threading # pylint: disable=E0401 import threading # noqa orig_threading.current_thread.__globals__['_active'] = threading._active +import os_brick from oslo_config import cfg from oslo_log import log as logging from oslo_privsep import priv_context @@ -178,6 +179,7 @@ def main(): priv_context.init(root_helper=shlex.split(utils.get_root_helper())) utils.monkey_patch() gmr.TextGuruMeditation.setup_autorun(version, conf=CONF) + os_brick.setup(CONF) global LOG LOG = logging.getLogger(__name__) diff --git a/releasenotes/notes/lock_path-940af881b2112bbe.yaml b/releasenotes/notes/lock_path-940af881b2112bbe.yaml new file mode 100644 index 00000000000..39d60a0e512 --- /dev/null +++ b/releasenotes/notes/lock_path-940af881b2112bbe.yaml @@ -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. diff --git a/requirements.txt b/requirements.txt index bb2ff913dd1..10b066d5c55 100644 --- a/requirements.txt +++ b/requirements.txt @@ -56,7 +56,7 @@ tenacity>=6.3.1 # Apache-2.0 WebOb>=1.8.6 # MIT oslo.i18n>=5.1.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 tooz>=2.7.1 # Apache-2.0 google-api-python-client>=1.11.0 # Apache-2.0 diff --git a/tools/config/cinder-config-generator.conf b/tools/config/cinder-config-generator.conf index 0ebd6b1c51d..44267420ae2 100644 --- a/tools/config/cinder-config-generator.conf +++ b/tools/config/cinder-config-generator.conf @@ -19,3 +19,4 @@ namespace = oslo.service.service namespace = oslo.service.sslutils namespace = oslo.service.wsgi namespace = oslo.versionedobjects +namespace = os_brick