Skip to content

python-common/rgw: fix get_realm_tokens returning empty result for realms with a secondary zone - #70214

Merged
afreen23 merged 1 commit into
ceph:mainfrom
rhcs-dashboard:fix-78232-main
Jul 21, 2026
Merged

afreen23 merged 1 commit into
ceph:mainfrom
rhcs-dashboard:fix-78232-main

Conversation

@aaSharma14

@aaSharma14 aaSharma14 commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Issue: The Export Multi-site Realm Token feature in the Dashboard showed no token and no realm details for any realm that had a secondary zone configured (i.e. the realm had been replicated to another cluster). The API endpoint GET /api/rgw/realm/get_realm_tokens returned an empty list or raised a 500 Internal Server Error.

Root cause: The bug was in [RGWAM.get_realms_info()] introduced in commit e4183b2 (tracker #67897). That commit added a guard:
local_zone_list = self.zone_op().list() # radosgw-admin zone list if master_zone_name in local_zone_list:
radosgw-admin zone list returns only zones whose RGWZoneParams are stored locally in RADOS on that cluster. On a secondary site the local zone list contains only the secondary zone - the master zone belongs to the primary cluster. The guard therefore silently skipped every realm on the secondary site, producing an empty result.
Additionally, the fallback zone get --zone-id=<master_zone_id> introduced in the same commit would crash with ENOENT on the secondary site because RGWZoneParams for the master zone is not stored locally, causing the 500 error.

Fix:

  1. Remove the local_zone_list guard entirely. The RGW period map is fully replicated to every site in the realm. All the realm/zonegroup/zone topology data (including master zone ID and endpoints) is always available locally via radosgw-admin period get.

  2. Gracefully handle zone get --zone-id=<master_zone_id> failure on secondary sites. RGWZoneParams (which holds system_key) is a per-zone RADOS object - only the local zone's params exist on a secondary cluster. When the master zone lookup raises ENOENT, fall back to fetching any locally-present zone's params. This is correct because the secondary zone is always created with the same access_key/secret as the master system user.

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

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

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)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@aaSharma14
aaSharma14 requested a review from a team as a code owner July 15, 2026 09:31
@aaSharma14
aaSharma14 requested review from adk3798 and cbodley July 15, 2026 09:31
@cbodley
cbodley requested review from a team and yehudasa July 15, 2026 12:32
@aaSharma14

Copy link
Copy Markdown
Contributor Author

jenkins test api

@afreen23 afreen23 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The root cause analysis is correct — secondary sites can't run zone get --zone-id=<master_zone_id> because master zone params aren't stored locally. Extracting the endpoint directly from the period map avoids that lookup entirely, which is the right approach.

Two things:

  • get_master_zone_name (line ~883) is no longer called by get_realms_info and has no other callers in this file — it's dead code now. Please remove it.
  • No unit tests for the new _get_master_zone_ep_from_period or for the fallback credential path — please add at least a mock-based test for the secondary-site scenario.

…alms with a secondary zone

Issue: The Export Multi-site Realm Token feature in the Dashboard showed no token and no realm details for any realm that had a secondary zone configured (i.e. the realm had been replicated to another cluster). The API endpoint GET /api/rgw/realm/get_realm_tokens returned an empty list or raised a 500 Internal Server Error.

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

Signed-off-by: Aashish Sharma <[email protected]>

@afreen23 afreen23 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@afreen23
afreen23 merged commit e197383 into ceph:main Jul 21, 2026
6 checks passed
@afreen23
afreen23 deleted the fix-78232-main branch July 21, 2026 11:54
@afreen23

Copy link
Copy Markdown
Contributor

I missed the fact it would need reviews from RGW team as well. My bad, though it was a small issue, please review we can open a new PR with followups. Thanks

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants