From 73ebb705425047f781dccc13508ba82bb1434db7 Mon Sep 17 00:00:00 2001 From: Gorka Eguileor Date: Fri, 8 Jul 2022 14:08:09 +0200 Subject: [PATCH] Support os-brick specific lock_path for Cinder As a new feature relevant for the Cinder store, 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 backward compatible way so code works even if using an os-brick version that doesn't have this feature. That is the case for many CI jobs that install os-brick from PyPi instead of the code present in master. Change-Id: Ib11d63e3c388e12f145f40247d17030a566b8c5e --- glance_store/_drivers/cinder.py | 2 ++ releasenotes/notes/lock_path-cef9d6f5f52c3211.yaml | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 releasenotes/notes/lock_path-cef9d6f5f52c3211.yaml diff --git a/glance_store/_drivers/cinder.py b/glance_store/_drivers/cinder.py index feee5ac8..8a50862f 100644 --- a/glance_store/_drivers/cinder.py +++ b/glance_store/_drivers/cinder.py @@ -45,6 +45,7 @@ try: from cinderclient import api_versions from cinderclient import exceptions as cinder_exception from cinderclient.v3 import client as cinderclient + import os_brick from os_brick.initiator import connector from oslo_privsep import priv_context except ImportError: @@ -480,6 +481,7 @@ class Store(glance_store.driver.Store): else: self.store_conf = self.conf.glance_store self.volume_api = cinder_utils.API() + getattr(os_brick, 'setup', lambda x: None)(CONF) def _set_url_prefix(self): self._url_prefix = "cinder://" diff --git a/releasenotes/notes/lock_path-cef9d6f5f52c3211.yaml b/releasenotes/notes/lock_path-cef9d6f5f52c3211.yaml new file mode 100644 index 00000000..bcb13d36 --- /dev/null +++ b/releasenotes/notes/lock_path-cef9d6f5f52c3211.yaml @@ -0,0 +1,12 @@ +--- +features: + - | + When using the cinder backend, a custom os-brick file lock location can be + specified using the ``lock_path`` configuration option in the + ``[os_brick]`` configuration section. Helpful when deploying on the same + host as the Cinder service. +upgrade: + - | + 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.