Skip to content

mgr/dashboard: keep tenant when editing a bucket without changing owner - #73065

Open
rishitrawat2006 wants to merge 1 commit into
ceph:mainfrom
rishitrawat2006:fix-rgw-bucket-set-tenant
Open

rishitrawat2006 wants to merge 1 commit into
ceph:mainfrom
rishitrawat2006:fix-rgw-bucket-set-tenant

Conversation

@rishitrawat2006

Copy link
Copy Markdown

When a bucket is edited (e.g. its replication is changed) the owner is not being changed, so the request carries an empty uid. RgwBucket.set() derived the tenant from the uid only. The tenant was therefore dropped from the bucket name ('kenny/test-bucket' became 'test-bucket') and RGW was queried as the dashboard's own user, which lives in the default tenant. RGW answered NoSuchBucket, which surfaced as an HTTP 500 from get_bucket_locking().

When no uid is given, look up the bucket and take the tenant and owner from it, the same way RgwBucket.get() does. Add a unit test.

Fixes: https://tracker.ceph.com/issues/81765

I tested this with a unit test using mocks, and the test fails without the change. I have not tested it against a real multi-tenant RGW cluster, so a review of that part would be appreciated. In the empty-uid case the change adds one extra RGW request.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)

When a bucket is edited (e.g. its replication is changed) the owner is
not being changed, so the request carries an empty uid. RgwBucket.set()
derived the tenant from the uid only. The tenant was therefore dropped
from the bucket name ('kenny/test-bucket' became 'test-bucket') and RGW
was queried as the dashboard's own user, which lives in the default
tenant. RGW answered NoSuchBucket, which surfaced as an HTTP 500 from
get_bucket_locking().

When no uid is given, look up the bucket and take the tenant and owner
from it, the same way RgwBucket.get() does. Add a unit test.

Fixes: https://tracker.ceph.com/issues/81765
Signed-off-by: Rishit Rawat <rawatrishit2029@gmail.com>
@github-actions

Copy link
Copy Markdown

Thank you for your contribution. Since you are not yet a member of the Ceph organization with write permissions on ceph/ceph.git, our CI will not automatically run. Any member of the Ceph organization may label this PR ci-approved to allow Jenkins CI jobs to run.

@rishitrawat2006

Copy link
Copy Markdown
Author

@AnuragRaut08 could u pls review it

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

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

1 participant