Update finding radosnamespace and cephblockpoolradosnamespace#15145
Update finding radosnamespace and cephblockpoolradosnamespace#15145jilju wants to merge 4 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jilju The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Signed-off-by: Jilju Joy <jijoy@redhat.com>
Signed-off-by: Jilju Joy <jijoy@redhat.com>
3e66e17 to
cc3155c
Compare
Signed-off-by: Jilju Joy <jijoy@redhat.com>
📝 WalkthroughWalkthroughThis PR refactors CephBlockPoolRadosNamespace (RNS) resolution logic in DR and helper utilities to dynamically discover RNS names from Kubernetes CRs instead of relying on hardcoded naming patterns. A new ChangesRadosnamespace Discovery and Resolution
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ocs_ci/helpers/dr_helpers.py`:
- Around line 424-437: The discovery of CephBlockPoolRadosNamespace objects must
run against the provider cluster; wrap the list/get call that builds
cephblockpool_rns_names (the ocp.OCP(kind=constants.CEPHBLOCKPOOLRADOSNS,
namespace=config.ENV_DATA["cluster_namespace"]).get()) and the subsequent
filter/selection of cephbpradosns inside
config.RunWithConfigContext(config.get_provider_index()) so both the list and
the computed cephbpradosns resolve against the provider context (ensure the same
context manager encloses the creation of cephblockpool_rns_names and the
filtering that sets cephbpradosns).
- Around line 428-437: The code builds cephblockpool_rns_names and then does
list(filter(...))[0], which raises IndexError when there is no match; change the
logic in the cephblockpool_rns_names/cephbpradosns handling to capture the
filtered result into a variable, check if it's empty, and if so raise the
expected NotFoundError (or return/handle accordingly) with a clear message
including the search pattern and namespace; apply the same empty-check-and-raise
fix to the similar occurrence around the cephblockpool_rns_names usage at the
later block (the second filter that currently indexes [0]).
In `@ocs_ci/helpers/helpers.py`:
- Around line 6965-6986: The current logic in find_radosnamespace() relies on
substring filters over cephblockpool_rns_names and then indexing [0], which can
IndexError when metadata names don't include -{storageconsumer}; instead, load
the resourceNameMappingConfigMap (if present) to map storageconsumer ->
radosnamespace metadata name, otherwise iterate the CEPHBLOCKPOOLRADOSNS items
(from ocp.OCP(...).get()["items"]) and match either item["spec"]["name"] or
config.ENV_DATA.get("radosnamespace_name") against item["spec"]["name"] (or
compare the mapping value to item["metadata"]["name"]) to find the correct CR
without using substring matching; if no CR is found, raise a clear, controlled
exception indicating the missing radosnamespace for the given storageconsumer.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 5d8faf15-d90d-4021-8cf1-886f6df69ffb
📒 Files selected for processing (3)
.secrets.baselineocs_ci/helpers/dr_helpers.pyocs_ci/helpers/helpers.py
Update the functions that find cephblockpoolradosnamespace CR and radosnamespace based on the new naming format in erasure coded cluster.
This change fixes #15126 as well
Summary by CodeRabbit