os-brick/os_brick/initiator/connectors
Gorka Eguileor 6a43669edc 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
2021-11-11 15:52:21 +01:00
..
__init__.py Splitting Out Connectors from connector.py 2016-08-02 15:54:15 -05:00
base.py Introduce mypy 2021-05-21 16:58:22 -04:00
base_iscsi.py iSCSI: Fix flushing after multipath cfg change 2021-03-26 11:07:45 +01:00
base_rbd.py rbd Windows support 2020-12-09 20:50:24 +02:00
fake.py Refactor iSCSI disconnect 2017-05-31 15:31:20 +02:00
fibre_channel.py Use file locks in connectors 2021-11-11 15:52:21 +01:00
fibre_channel_ppc64.py Incorporate the connection_properties input for PPC64 2018-03-20 09:23:12 -04:00
fibre_channel_s390x.py Fix import order of libraries 2021-03-03 16:27:19 -05:00
gpfs.py Add connector for GPFS volumes 2016-08-16 16:09:52 +05:30
huawei.py Use file locks in connectors 2021-11-11 15:52:21 +01:00
iscsi.py Use file locks in connectors 2021-11-11 15:52:21 +01:00
local.py doc: Restructure docs for doc-migration 2017-08-08 15:44:29 +01:00
nvmeof.py Use file locks in connectors 2021-11-11 15:52:21 +01:00
rbd.py rbd Windows support 2020-12-09 20:50:24 +02:00
remotefs.py Refactor iSCSI disconnect 2017-05-31 15:31:20 +02:00
scaleio.py Use file locks in connectors 2021-11-11 15:52:21 +01:00
storpool.py Remove six 2021-03-03 14:41:22 +08:00
vmware.py vmware: Use cookiejar from oslo.vmware client directly 2021-04-28 07:58:47 +00:00