cinder/cinder/tests/unit/api
Eric Harney 5f9c93b194 Prevent double-attachment race in attachment_reserve
If multiple attachments are requested simultaneously,
a volume can be attached to an instance more than once.

This fixes this problem by detecting that a race has
occurred in _attachment_reserve, and backing out one of
the invalid attachment records.

This means that if the attachment API is called
repeatedly and quickly for the same volume, some requests
may fail, but this is much better than incorrectly
creating multiple attachments.

Closes-Bug: #1833736

Change-Id: Ic2463338b698c5cf805c0ae06d0229f54f64b3fc
(cherry picked from commit 7f3a77b66f)
(cherry picked from commit eadff0df7e)
Conflicts:
	cinder/tests/unit/attachments/test_attachments_api.py
Depends-On: https://review.opendev.org/673851/
2019-08-01 13:34:44 -04:00
..
contrib Consume quota when importing backup resource 2018-08-01 13:48:25 -05:00
middleware Add Keystone v3 domain information to context 2018-04-25 09:29:33 -04:00
openstack Remove API check is_valid_body 2017-10-10 00:53:07 +00:00
v2 Merge "Add policy check for type show and type list" 2018-08-07 23:15:51 +00:00
v3 Prevent double-attachment race in attachment_reserve 2019-08-01 13:34:44 -04:00
views Fix version return incorrect when endpoint url end without / 2019-02-25 13:06:03 +00:00
__init__.py Move unit tests into dedicated directory 2015-04-21 18:40:40 -06:00
fakes.py Fix consisgroup V3 interfaces 2016-07-04 16:21:44 +08:00
test_api_validation.py Tests: Fix python version check 2018-02-16 14:43:53 -05:00
test_common.py Reject any filter whose key contains non ascii character 2018-06-20 03:39:10 +00:00
test_versions.py Exclude disabled API versions from listing 2019-02-27 11:04:45 -06:00