Use volume shared_targets to lock during attach/detach
The Cinder 3.48 API provides a shared_targets and service_uuid field in the volume resource which tells the caller whether or not it should lock operations on that volume. This change adds that logic to the DriverVolumeBlockDevice attach and detach flows by first trying to get the volume at the 3.48 microversion and if that's not available, it simply falls back to get the volume the same as before. If 3.48 is available and the volume storage backend uses shared targets, we synchronize the attach/detach operations using the volume service_uuid, which is based on the storage backend and is also configurable by the deployer on the Cinder side. This is a nice to have protection for "normal" volumes but is really needed for multiattach volumes to be detached safely. See Cinder blueprint add-shared-targets-flag-to-volume for details. Part of blueprint multi-attach-volume Depends-On: I3c07cd8458d55535a71626ffaa8ca50deb3ca3dd Change-Id: I5e96602184242fb9017c0434b445a3875f3b149a
This commit is contained in:
@@ -1325,7 +1325,7 @@ class CinderFixture(fixtures.Fixture):
|
||||
def setUp(self):
|
||||
super(CinderFixture, self).setUp()
|
||||
|
||||
def fake_get(self_api, context, volume_id):
|
||||
def fake_get(self_api, context, volume_id, microversion=None):
|
||||
# Check for the special swap volumes.
|
||||
if volume_id in (CinderFixture.SWAP_OLD_VOL,
|
||||
CinderFixture.SWAP_ERR_OLD_VOL):
|
||||
@@ -1499,7 +1499,7 @@ class CinderFixtureNewAttachFlow(fixtures.Fixture):
|
||||
def setUp(self):
|
||||
super(CinderFixtureNewAttachFlow, self).setUp()
|
||||
|
||||
def fake_get(self_api, context, volume_id):
|
||||
def fake_get(self_api, context, volume_id, microversion=None):
|
||||
# Check for the special swap volumes.
|
||||
if volume_id in (CinderFixture.SWAP_OLD_VOL,
|
||||
CinderFixture.SWAP_ERR_OLD_VOL):
|
||||
|
Reference in New Issue
Block a user