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
This commit is contained in:
Gorka Eguileor 2022-07-08 14:08:09 +02:00
parent 5ff06df97f
commit 73ebb70542
2 changed files with 14 additions and 0 deletions

View File

@ -45,6 +45,7 @@ try:
from cinderclient import api_versions from cinderclient import api_versions
from cinderclient import exceptions as cinder_exception from cinderclient import exceptions as cinder_exception
from cinderclient.v3 import client as cinderclient from cinderclient.v3 import client as cinderclient
import os_brick
from os_brick.initiator import connector from os_brick.initiator import connector
from oslo_privsep import priv_context from oslo_privsep import priv_context
except ImportError: except ImportError:
@ -480,6 +481,7 @@ class Store(glance_store.driver.Store):
else: else:
self.store_conf = self.conf.glance_store self.store_conf = self.conf.glance_store
self.volume_api = cinder_utils.API() self.volume_api = cinder_utils.API()
getattr(os_brick, 'setup', lambda x: None)(CONF)
def _set_url_prefix(self): def _set_url_prefix(self):
self._url_prefix = "cinder://" self._url_prefix = "cinder://"

View File

@ -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.