We introduced "shared_targets" and "service_uuid" fields in volumes to allow volume consumers to protect themselves from unintended leftover devices when handling iSCSI connections with shared targets. The way they protect themselves from the automatic scans that happen on detach/map race conditions is by locking and only allowing one attach or one detach operation for each server to happen at a given time. When using an up to date Open iSCSI initiator we don't need to use locks, as it has the possibility to disable automatic LUN scans (which are the real cause of the leftover devices), and OS-Brick already supports this feature. This is currently not the case, since Nova is blindly locking whenever "shared_targets" is set to True. Thanks to the context manager introduced in this patch we can improve our separation of concerns (Nova doesn't have to care when we have to lock), and we can fine tune the locking to only lock when the iSCSI initiator doesn't support disabling automatic scans. The context manager "guard_connection" lives in "os_brick.initiator.utils" and needs a cinder volume. The volume can be passed as a dictionary or OVO instance. Change-Id: I4970363301d5d1f4e7d0f07e09b34d15ee6884c3 Related-Bug: #1800515
1.4 KiB
1.4 KiB