cannot update previously deleted drivers_private_storage entries

Bug #1721123 reported by Rodrigo Barbieri
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Shared File Systems Service (Manila)
Fix Released
Medium
Rodrigo Barbieri

Bug Description

The drivers_private_storage is expected to be able to save new entries using the same keys as previously deleted entries.

Unfortunately, the misinterpretation of a parameter in the manila DB API led to a bug preventing the above behavior from working properly.

This line is the misinterpretation which confirms the expected behavior: https://github.com/openstack/manila/blob/3a9f67a90f8a8dac3cc08b1f19dd66b40da303cb/manila/db/sqlalchemy/api.py#L3508

The "read_deleted=None" parameter prevents the following line from being executed because deleted entries are not retrieved: https://github.com/openstack/manila/blob/3a9f67a90f8a8dac3cc08b1f19dd66b40da303cb/manila/db/sqlalchemy/api.py#L3519

One very easy way to reproduce this problem is to add "db_api.driver_private_data_delete(self.ctxt, test_id)" between the 2 update calls in https://github.com/openstack/manila/blob/3a9f67a90f8a8dac3cc08b1f19dd66b40da303cb/manila/tests/db/sqlalchemy/test_api.py#L1651

Changed in manila:
assignee: nobody → Rodrigo Barbieri (rodrigo-barbieri2010)
Changed in manila:
status: New → Confirmed
importance: Undecided → Medium
milestone: none → queens-1
Revision history for this message
Goutham Pacha Ravi (gouthamr) wrote :

Driver private data was designed to store items that drivers can manipulate, along the design, we may have percolated the idea that driver_private_data is analogous to any other table that is part of the Manila database schema, it isn't.

Manila database has hooks, and there are genuine use cases when Administrators of a Manila installation can access or manipulate data outside of the manila-api (that's the reason why manila-manage exists). Our database schema thus has a contract on upgrades or retention for audits. The same thing cannot be said of driver_private_data. Drivers are free to store whatever they want, since it is a key-value store, and there are no hard-binding upgrade or retention procedures as opposed to any other table/store that is part of the schema.

With that said, I think we should hard delete rows from this store, there is absolutely no valid reason why data deleted by the driver needs to be accessible after deletes.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to manila (master)

Fix proposed to branch: master
Review: https://review.openstack.org/514389

Changed in manila:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to manila (master)

Reviewed: https://review.openstack.org/514389
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=ebac41d6314adb4046c097fcb1046308f3776d31
Submitter: Zuul
Branch: master

commit ebac41d6314adb4046c097fcb1046308f3776d31
Author: Rodrigo Barbieri <email address hidden>
Date: Tue Oct 3 15:15:00 2017 -0300

    Fix drivers_private_data update on deleted entries

    The drivers_private_data is expected to be able to
    save new entries using the same keys as previously deleted
    entries.

    Before performing an update, it retrieves all entries
    related to the same entity to check if it needs to
    perform an update (including on deleted entries) or a
    new insertion.

    Unfortunately, the misinterpretation of a parameter in the
    manila DB API led to a bug that prevented deleted entries
    to be retrieved.

    This bugfix replaces the query ensuring that all entries
    (active and deleted) are retrieved so the update validation
    works.

    Closes-bug: #1721123

    Change-Id: Id94544c9b8a534d7f0fe4e16bc57546002e33373

Changed in manila:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/manila 6.0.0.0b2

This issue was fixed in the openstack/manila 6.0.0.0b2 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to manila (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/529105

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to manila (stable/pike)

Reviewed: https://review.openstack.org/529105
Committed: https://git.openstack.org/cgit/openstack/manila/commit/?id=abb480f27da50c32c72d21ef69f5d173c48340a9
Submitter: Zuul
Branch: stable/pike

commit abb480f27da50c32c72d21ef69f5d173c48340a9
Author: Rodrigo Barbieri <email address hidden>
Date: Tue Oct 3 15:15:00 2017 -0300

    Fix drivers_private_data update on deleted entries

    The drivers_private_data is expected to be able to
    save new entries using the same keys as previously deleted
    entries.

    Before performing an update, it retrieves all entries
    related to the same entity to check if it needs to
    perform an update (including on deleted entries) or a
    new insertion.

    Unfortunately, the misinterpretation of a parameter in the
    manila DB API led to a bug that prevented deleted entries
    to be retrieved.

    This bugfix replaces the query ensuring that all entries
    (active and deleted) are retrieved so the update validation
    works.

    Closes-bug: #1721123

    Change-Id: Id94544c9b8a534d7f0fe4e16bc57546002e33373
    (cherry picked from commit ebac41d6314adb4046c097fcb1046308f3776d31)

tags: added: in-stable-pike
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/manila 5.0.2

This issue was fixed in the openstack/manila 5.0.2 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.