manila/manila/api
haixin dcf74f5223 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)
(cherry picked from commit a9e0ca254e)
2020-12-16 16:32:23 +00:00
..
contrib Port share type extensions to core API 2015-11-12 14:58:20 +00:00
middleware Fix UnicodeDecodeError when decode API input 2018-02-07 06:37:32 +00:00
openstack Add share network with multiple subnets 2019-09-13 11:27:18 -03:00
v1 Fix logic that determines a share exists before manage 2020-12-16 16:32:23 +00:00
v2 Enforce policy checks for share export locations 2020-03-24 15:15:58 +00:00
views Merge "Fix _list_view function for count" 2019-09-20 02:24:36 +00:00
__init__.py Remove enable_v1_api and enable_v2_api config opts 2016-08-23 08:27:22 +02:00
auth.py Remove log translations in api 1/5 2017-03-29 16:55:05 +08:00
common.py Merge "Fix pagination does not speed up queries bug" 2019-09-26 16:50:53 +00:00
extensions.py If only .pyc exist, the extension API will be disabled 2020-03-27 12:11:51 +00:00
urlmap.py Trivial: Remove unused logging import 2015-12-28 21:44:26 -05:00
versions.py [pylint] Fix/ignore pylint errors in non-test modules 2019-02-25 17:23:15 +00:00