Skip to content

Fix access-delete 404 for orphaned share access rules - #352

Open
kpawar-sap wants to merge 1 commit into
stable/2025.1-m3from
fix_access_delete
Open

kpawar-sap wants to merge 1 commit into
stable/2025.1-m3from
fix_access_delete

Conversation

@kpawar-sap

Copy link
Copy Markdown

When a ShareAccessMapping row exists with no associated ShareInstanceAccessMapping rows (an "orphaned" access rule), the user is stuck in an unrecoverable state:

openstack share access show -> succeeds (state: None)
openstack share access list -> rule NOT shown
openstack share access delete ... -> 404 NotFound
openstack share access allow (same IP) -> "already exists" error

In all cases share_access_get() finds the orphaned row (no instance- mapping filter), while share_access_get_all_for_share() does not (it filters on instance_mappings.any()), causing the inconsistency.

deny_access_to_instance() catches NotFound (no instance mapping for a share instance) and returns False rather than propagating a 404. deny_access() detects when every instance returned False and calls db.share_access_delete() directly to clean up the orphaned record, making 'access delete' succeed.

Change-Id: I19b2e1b7b44d7d1e5a3dfaf1a93efbae27af8df7

(cherry picked from commit e283921)

When a ShareAccessMapping row exists with no associated
ShareInstanceAccessMapping rows (an "orphaned" access rule), the user
is stuck in an unrecoverable state:

  openstack share access show <id>       -> succeeds (state: None)
  openstack share access list <share-id> -> rule NOT shown
  openstack share access delete ...      -> 404 NotFound
  openstack share access allow (same IP) -> "already exists" error

In all cases share_access_get() finds the orphaned row (no instance-
mapping filter), while share_access_get_all_for_share() does not
(it filters on instance_mappings.any()), causing the inconsistency.

deny_access_to_instance() catches NotFound (no instance mapping for
a share instance) and returns False rather than propagating a 404.
deny_access() detects when every instance returned False and calls
db.share_access_delete() directly to clean up the orphaned record,
making 'access delete' succeed.

Change-Id: I19b2e1b7b44d7d1e5a3dfaf1a93efbae27af8df7
Signed-off-by: Kiran Pawar <kinpaa@gmail.com>
(cherry picked from commit e283921)
@kpawar-sap

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants