diff options
author | Zuul <zuul@review.opendev.org> | 2023-05-03 17:27:17 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2023-05-03 17:27:17 +0000 |
commit | 7fd4c49b16f511574a4790e19b662f029d3ea2f6 (patch) | |
tree | 8b22e38d557b7a11d2580e675b538745a61c5b58 /glance_store/_drivers | |
parent | 96f28eb35c16b2feef1465ef46f19b5407eb4833 (diff) | |
parent | 2c3442a397c97e78f53b27e44b610752035b6f09 (diff) | |
download | glance_store-7fd4c49b16f511574a4790e19b662f029d3ea2f6.tar.gz |
Merge "move attachment_update to try block"
Diffstat (limited to 'glance_store/_drivers')
-rw-r--r-- | glance_store/_drivers/cinder/store.py | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/glance_store/_drivers/cinder/store.py b/glance_store/_drivers/cinder/store.py index b587c7e..bfcadc6 100644 --- a/glance_store/_drivers/cinder/store.py +++ b/glance_store/_drivers/cinder/store.py @@ -728,18 +728,20 @@ class Store(glance_store.driver.Store): mode=attach_mode) LOG.debug('Attachment %(attachment_id)s created successfully.', {'attachment_id': attachment['id']}) - attachment = self.volume_api.attachment_update( - client, attachment['id'], connector_prop, - mountpoint='glance_store') - LOG.debug('Attachment %(attachment_id)s updated successfully with ' - 'connection info %(conn_info)s', - {'attachment_id': attachment.id, - 'conn_info': strutils.mask_dict_password( - attachment.connection_info)}) - volume = volume.manager.get(volume_id) - connection_info = attachment.connection_info + volume = volume.manager.get(volume_id) + attachment_id = attachment['id'] + connection_info = None try: + attachment = self.volume_api.attachment_update( + client, attachment_id, connector_prop, + mountpoint='glance_store') + LOG.debug('Attachment %(attachment_id)s updated successfully with ' + 'connection info %(conn_info)s', + {'attachment_id': attachment_id, + 'conn_info': strutils.mask_dict_password( + attachment.connection_info)}) + connection_info = attachment.connection_info conn = base.factory( connection_info['driver_volume_type'], volume=volume, @@ -753,9 +755,9 @@ class Store(glance_store.driver.Store): # Complete the attachment (marking the volume "in-use") after # the connection with os-brick is complete - self.volume_api.attachment_complete(client, attachment.id) + self.volume_api.attachment_complete(client, attachment_id) LOG.debug('Attachment %(attachment_id)s completed successfully.', - {'attachment_id': attachment.id}) + {'attachment_id': attachment_id}) self.volume_connector_map[volume.id] = conn if (connection_info['driver_volume_type'] == 'rbd' and @@ -774,7 +776,7 @@ class Store(glance_store.driver.Store): try: if volume.multiattach: attachment_state_manager.detach( - client, attachment.id, volume_id, host, conn, + client, attachment_id, volume_id, host, conn, connection_info, device) else: conn.disconnect_volume(device) @@ -786,7 +788,7 @@ class Store(glance_store.driver.Store): {'volume_id': volume.id}) if not volume.multiattach: - self.volume_api.attachment_delete(client, attachment.id) + self.volume_api.attachment_delete(client, attachment_id) def _cinder_volume_data_iterator(self, client, volume, max_size, offset=0, chunk_size=None, partial_length=None): |