Volume discovery and local storage management lib
Go to file
Gorka Eguileor 9090cb79ef Use file locks in connectors
Currently os-brick is using in-process locks that will only prevent concurrent
access to critical sections to threads within a single process.

But based on the comment from iSCSI it seems like the code assumed that
these were file based locks that prevented concurrent access from
multiple processes.

Mentioned iSCSI comment is being removed because it's not correct that
our current retry mechanism will work with connect and disconnect
concurrency issues.

The reason why we haven't seen errors in Nova is because it runs a
single process and locks will be effective.

This is probably also not an issue in some transport protocols, such as
FC and RBD, and it wouldn't be an issue in iSCSI connections that don't
share targets.

But for others, such as  iSCSI with shared targets and NVMe-OF, not
using file locks will create race conditions in the following cases:

- More than 1 cinder backend: Because we can have one backend doing a
  detach in a create volume from image and the other an attach for an
  offline migration.

- Backup/Restore if backup and volume services are running on the same
  host.

- HCI scenarios where cinder volume and nova compute are running on the
  same host, even if the same lock path if configured.

- Glance using Cinder as backend and is running on the same node as
  cinder-volume or cinder-backup.

The problematic race conditions happen because the disconnect will do a
logout of the iSCSI target once the connect call has already confirmed
that the session to the target exists.

We could just add the file locks to iSCSI and NVMe, but I think it's
safer to add it to all the connectors and then, after proper testing, we
can can change back the locks that can be changed, and remove or reduce
the critical section in others.

Closes-Bug: #1947370
Change-Id: I6f7f7d19540361204d4ae3ead2bd6dcddb8fcd68
(cherry picked from commit 6a43669edc)
(cherry picked from commit 19a4820f5c)
Conflicts: os_brick/initiator/connectors/iscsi.py
(cherry picked from commit 08ddf69d64)
Conflicts: os_brick/initiator/connectors/nvmeof.py
(cherry picked from commit b03eca8353)
Conflicts: os_brick/tests/base.py
Conflicts: os_brick/initiator/connectors/iscsi.py
2022-06-21 16:29:25 +09:00
doc Merge "Add pdf documentation build in tox" 2019-08-30 09:23:00 +00:00
etc/os-brick/rootwrap.d Trivial rootwrap -> privsep replacement 2016-04-15 15:29:25 +00:00
os_brick Use file locks in connectors 2022-06-21 16:29:25 +09:00
releasenotes Use file locks in connectors 2022-06-21 16:29:25 +09:00
tools Split connector list by platform 2020-02-06 07:54:15 +00:00
.coveragerc Fix coverage generation 2016-04-20 15:52:31 +00:00
.gitignore Add LIO barbican tests to .zuul.yaml 2018-10-01 10:19:36 -05:00
.gitreview Update .gitreview for stable/train 2019-09-05 08:32:00 +00:00
.mailmap Created the Brick library from Cinder 2015-01-22 19:09:30 +00:00
.stestr.conf Add .stestr.conf configuration 2017-10-02 17:35:26 -05:00
.zuul.yaml Drop lower-constraints job 2021-04-09 14:51:49 -04:00
CONTRIBUTING.rst Update and replace http with https for doc links 2017-07-26 02:18:44 +00:00
HACKING.rst Update hacking version 2019-01-18 21:30:00 -05:00
LICENSE Created the Brick library from Cinder 2015-01-22 19:09:30 +00:00
README.rst Replace git.openstack.org URLs with opendev.org URLs 2019-04-23 20:55:14 +08:00
babel.cfg Created the Brick library from Cinder 2015-01-22 19:09:30 +00:00
bindep.txt Add pdf documentation build in tox 2019-08-29 11:41:33 -07:00
lower-constraints.txt Adjust lower-constraints 2020-12-22 12:02:14 -05:00
pylintrc Add pylint tox env 2016-04-04 18:02:19 -04:00
requirements.txt Add oslo.context dependency 2021-01-25 09:29:34 -05:00
setup.cfg Remove py35 from setup.cfg 2019-02-28 11:02:40 +05:30
setup.py Updated from global requirements 2017-03-10 19:12:09 +00:00
test-requirements.txt Adjust lower-constraints 2020-12-22 12:02:14 -05:00
tox.ini Update TOX/UPPER_CONSTRAINTS_FILE for stable/train 2019-09-05 08:32:03 +00:00

README.rst

Team and repository tags

image

brick

Latest Version

Downloads

OpenStack Cinder brick library for managing local volume attaches

Features

  • Discovery of volumes being attached to a host for many transport protocols.
  • Removal of volumes from a host.

Hacking

Hacking on brick requires python-gdbm (for Debian derived distributions), Python 2.7 and Python 3.4. A recent tox is required, as is a recent virtualenv (13.1.0 or newer).

If "tox -e py34" fails with the error "db type could not be determined", remove the .testrepository/ directory and then run "tox -e py34".

For any other information, refer to the developer documents:

https://docs.openstack.org/os-brick/latest/

OR refer to the parent project, Cinder:

https://docs.openstack.org/cinder/latest/

Release notes for the project can be found at:

https://docs.openstack.org/releasenotes/os-brick