Update to support new attachment API mv 3.44
Currently, attempts to use local-attach with the newest attachment API microversion, 3.44, results in the attchment hanging at 'attaching'. This is because brick-cinderclient-ext was not updated to use the 'attachment.complete(attachment_id) step when attaching. This adds this call so that the attachment will complete. Change-Id: I19983e3e38771da87b8471673a15daf59dc5f25f closes-bug: 1739653
This commit is contained in:
parent
d6d3adbbed
commit
a281e67bf9
|
@ -49,7 +49,7 @@ class Client(object):
|
|||
current_version = cinderclient.version_info.semantic_version()
|
||||
if (self.volumes_client and current_version >= version_want):
|
||||
# We have a recent enough client to test the microversion we need.
|
||||
required_version = api_versions.APIVersion("3.27")
|
||||
required_version = api_versions.APIVersion("3.44")
|
||||
if self.volumes_client.api_version.matches(required_version):
|
||||
# we can use the new attach/detach API
|
||||
self._use_legacy_attach = False
|
||||
|
@ -156,6 +156,9 @@ class Client(object):
|
|||
use_multipath=multipath,
|
||||
)
|
||||
device_info = brick_connector.connect_volume(connection)
|
||||
# MV 3.44 requires this step to move the volume to 'in-use'.
|
||||
self.volumes_client.attachments.complete(
|
||||
info['connection_info']['attachment_id'])
|
||||
return device_info
|
||||
|
||||
def detach(self, volume_id, attachment_uuid=None, multipath=False,
|
||||
|
|
|
@ -109,13 +109,13 @@ class TestBrickClient(base.BaseTestCase):
|
|||
self.assertTrue(brick_client._use_legacy_attach)
|
||||
|
||||
@mock.patch('cinderclient.version_info.semantic_version')
|
||||
def test_client_use_new_attach_v2_cinderclient_3_27(self,
|
||||
def test_client_use_new_attach_v2_cinderclient_3_44(self,
|
||||
mock_semantic_version):
|
||||
self._init_fake_cinderclient('iscsi')
|
||||
mock_semantic_version.return_value = pbr_version.SemanticVersion(
|
||||
major=2, minor=0)
|
||||
self.client.volumes_client.version_info.semantic_version
|
||||
current_api_version = api_versions.APIVersion("3.27")
|
||||
current_api_version = api_versions.APIVersion("3.44")
|
||||
self.client.volumes_client.api_version = current_api_version
|
||||
brick_client = client.Client(self.client.volumes_client)
|
||||
|
||||
|
|
Loading…
Reference in New Issue