Bug 1849843 - Manage API allows an existing share to be managed
Summary: Manage API allows an existing share to be managed
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-manila
Version: 16.2 (Train)
Hardware: All
OS: All
medium
medium
Target Milestone: Alpha
: 16.2 (Train on RHEL 8.4)
Assignee: Goutham Pacha Ravi
QA Contact: vhariria
RHOS Documentation Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-23 00:09 UTC by Goutham Pacha Ravi
Modified: 2022-08-24 10:11 UTC (History)
9 users (show)

Fixed In Version: openstack-manila-9.1.5-2.20210121124925.ab3f41b.el8ost.1
Doc Type: Bug Fix
Doc Text:
Previously, the Shared File Systems service (manila) API that brings external shares into service management did not check for duplicated export locations. An existing share brought into the service multiple times results in an inconsistent state. + With this release, the API evaluates the export locations of known or existing shares before allowing external shares to be managed, and prevents existing shares from being erroneously brought into the Shared File Systems service again.
Clone Of:
Environment:
Last Closed: 2021-09-15 07:08:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1848608 0 None None None 2020-06-23 00:09:28 UTC
OpenStack gerrit 767326 0 None MERGED Fix logic that determines a share exists before manage 2021-02-12 19:18:17 UTC
Red Hat Issue Tracker OSP-2618 0 None None None 2022-08-24 10:11:23 UTC
Red Hat Product Errata RHEA-2021:3483 0 None None None 2021-09-15 07:09:06 UTC

Description Goutham Pacha Ravi 2020-06-23 00:09:29 UTC
Description of problem:

manila's Manage API [1] does not prevent re-managing an already managed share under certain circumstances. The API performs a check by comparing the export location provided against all known shares in the manila database. However, that check does not work currently when a share has multiple export locations.

The retrieval logic for search options looks suspicious:

https://opendev.org/openstack/manila/src/commit/b6b2eb5cf3a32e506af8734acecb4a34ceafc982/manila/share/api.py#L1709-L1718

There's an attempt to retrieve the export location with the key "export_location" on the Share model (https://opendev.org/openstack/manila/src/commit/b6b2eb5cf3a32e506af8734acecb4a34ceafc982/manila/share/api.py#L671), but in reality, there is no such key on the database schema.

There's a meta property on the share model, which just fetches a share's instance's first export location:

- https://opendev.org/openstack/manila/src/commit/b6b2eb5cf3a32e506af8734acecb4a34ceafc982/manila/db/sqlalchemy/models.py#L206-L208

- https://opendev.org/openstack/manila/src/commit/b6b2eb5cf3a32e506af8734acecb4a34ceafc982/manila/db/sqlalchemy/models.py#L353-L355


Version-Release number of selected component (if applicable): 13 - 16+


How reproducible: Sporadically


Steps to Reproduce:
1. Configure manila with a backend that can present multiple export paths - for example, a NetApp vServer that can expose two or more NICs
2. Create a share, note its export locations
3. Use the manage API with the export locations, one at a time

Actual results:
Step 3 sometimes passes, resulting in a share getting managed twice - this could be disruptive to existing clients, and in some cases disastrous, because it requires some special handling for doubly managed shares to remove the duplicates, without causing data loss.

Expected results:
Step 3 must be disallowed always



Additional info:


[1] https://docs.openstack.org/api-ref/shared-file-system/#manage-share-since-api-v2-7

Comment 12 errata-xmlrpc 2021-09-15 07:08:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Red Hat OpenStack Platform (RHOSP) 16.2 enhancement advisory), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2021:3483


Note You need to log in before you can comment on or make changes to this bug.