Correct attachment_complete call
Cinder's attachment_complete API is called to mark the volume from "attaching" state to "in-use" state stating that the volume is ready to use. In the current code, attachment_complete is called before the brick connection is complete. This should be done after the connection to brick is successful and we have a volume path to write the image into. This patch corrects the behavior. The wrong sequence of execution won't have any issues functionally since we open the volume after all steps are completed but flow wise it is incorrect. This change won't have any end user impact. Change-Id: Ia9652a4ff6d7efbabb58511f0ce93a87b3a4dfa8
This commit is contained in:
parent
395f792358
commit
e1ced9ea31
|
@ -710,7 +710,6 @@ class Store(glance_store.driver.Store):
|
|||
attachment = self.volume_api.attachment_update(
|
||||
client, attachment['id'], connector_prop,
|
||||
mountpoint='glance_store')
|
||||
self.volume_api.attachment_complete(client, attachment.id)
|
||||
volume = volume.manager.get(volume_id)
|
||||
connection_info = attachment.connection_info
|
||||
|
||||
|
@ -751,6 +750,10 @@ class Store(glance_store.driver.Store):
|
|||
device = connect_volume_nfs()
|
||||
else:
|
||||
device = conn.connect_volume(connection_info)
|
||||
|
||||
# Complete the attachment (marking the volume "in-use") after
|
||||
# the connection with os-brick is complete
|
||||
self.volume_api.attachment_complete(client, attachment.id)
|
||||
if (connection_info['driver_volume_type'] == 'rbd' and
|
||||
not conn.do_local_attach):
|
||||
yield device['path']
|
||||
|
|
|
@ -279,8 +279,6 @@ class TestCinderStore(base.StoreBaseTest,
|
|||
attach_update.assert_called_once_with(
|
||||
fake_client, fake_attachment_id,
|
||||
fake_conn_info, mountpoint='glance_store')
|
||||
attach_complete.assert_called_once_with(
|
||||
fake_client, fake_attachment_id)
|
||||
attach_delete.assert_called_once_with(
|
||||
fake_client, fake_attachment_id)
|
||||
|
||||
|
|
|
@ -312,8 +312,6 @@ class TestMultiCinderStore(base.MultiStoreBaseTest,
|
|||
attach_update.assert_called_once_with(
|
||||
fake_client, fake_attachment_id,
|
||||
fake_conn_info, mountpoint='glance_store')
|
||||
attach_complete.assert_called_once_with(
|
||||
fake_client, fake_attachment_id)
|
||||
attach_delete.assert_called_once_with(
|
||||
fake_client, fake_attachment_id)
|
||||
|
||||
|
|
Loading…
Reference in New Issue