diff --git a/manila/data/manager.py b/manila/data/manager.py index c78ece0767..e61bee362d 100644 --- a/manila/data/manager.py +++ b/manila/data/manager.py @@ -104,7 +104,7 @@ class DataManager(manager.Manager): context, share_ref, share_instance_id, dest_share_instance_id) raise exception.ShareDataCopyFailed(reason=msg) finally: - self.busy_tasks_shares.pop(share_id) + self.busy_tasks_shares.pop(share_id, None) LOG.info(_LI( "Completed copy operation of migrating share content from share " diff --git a/manila/tests/data/test_manager.py b/manila/tests/data/test_manager.py index f6b6d951be..af83b87ee5 100644 --- a/manila/tests/data/test_manager.py +++ b/manila/tests/data/test_manager.py @@ -86,7 +86,8 @@ class DataManagerTestCase(test.TestCase): self.mock_object(data_utils, 'Copy', mock.Mock(return_value='fake_copy')) - self.manager.busy_tasks_shares[self.share['id']] = 'fake_copy' + if exc is None: + self.manager.busy_tasks_shares[self.share['id']] = 'fake_copy' self.mock_object(self.manager, '_copy_share_data', mock.Mock(side_effect=exc))