manila/manila/tests/api
haixin a9e0ca254e Fix logic that determines a share exists before manage
The share "manage" API checks whether
an existing/known share is being imported by
matching the export path provided to existing
shares.

This lookup does not consider the
fact that shares may have multiple export
locations, because it relies on an old/deprecated
"export_location" property on shares which
was added to provide backwards compatibility
to the API that presented only one export
location per share.

Further, it's possible to get a
"ERROR: Invalid share: Share already exists"
exception even when no such share exists in the
database.

Fix the lookup by using the "export_location_path"
based lookup which is faster, since it performs
a meaningful join on the export locations table;
and remove the parameters "protocol"
and "share_type_id" - these things make no
difference when there's a duplicated export
location. We'll consider "host" as a lookup
parameter since we can't be sure that export
locations are unique in a deployment - but they
ought to be unique for a given host.

Closes-Bug: #1848608
Closes-Bug: #1893718
Change-Id: I1d1aef0c2b48764789b43b91b258def6464b389f
Co-Authored-By: Goutham Pacha Ravi <gouthampravi@gmail.com>
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
(cherry picked from commit 1b5771ef15)
(cherry picked from commit 5cff4d4b3f)
2020-12-08 21:06:25 -08:00
..
contrib Allow configuring availability_zones in share types 2019-02-13 17:39:48 +00:00
extensions Remove vim headers 2014-10-06 15:00:27 +02:00
middleware Fix UnicodeDecodeError when decode API input 2018-02-07 06:37:32 +00:00
openstack Use unittest.mock instead of third party lib 2020-04-17 16:24:27 -07:00
v1 Fix logic that determines a share exists before manage 2020-12-08 21:06:25 -08:00
v2 Fix logic that determines a share exists before manage 2020-12-08 21:06:25 -08:00
views Use unittest.mock instead of third party lib 2020-04-17 16:24:27 -07:00
__init__.py pep8: Enable H303 and F403 2014-08-23 10:40:52 +02:00
common.py Remove vim headers 2014-10-06 15:00:27 +02:00
fakes.py Hacking: Fix E117 2020-04-01 11:31:13 +02:00
test_common.py Use unittest.mock instead of third party lib 2020-04-17 16:24:27 -07:00
test_extensions.py Use unittest.mock instead of third party lib 2020-04-17 16:24:27 -07:00
test_middleware.py Added CORS support to Manila 2015-11-11 10:10:58 -08:00
test_versions.py Use unittest.mock instead of third party lib 2020-04-17 16:24:27 -07:00
test_wsgi.py Add possibility to run 'manila-api' with wsgi web servers 2017-04-10 12:49:20 +03:00