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

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
changes/26/849326/2 4.0.1
Gorka Eguileor 9 months ago
parent 5ff06df97f
commit 73ebb70542

@ -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):
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://"

@ -0,0 +1,12 @@
- |
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.
- |
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.