← Back to Pull requests

[IUO] Restart ocs-operator after CNV reinstall to create virt StorageClass #6304

Open
unknown opened this pull request with 451 lines diff across 5 files
View on GitHub
unknown unknown commented on Sep 14, 2026 15:08 UTC
Author

##### What this PR does / why we need it:

test_default_storage_class_set fails intermittently (~60%) in test-cnv-4.22-iuo-install-production because ocs-storagecluster-ceph-rbd-virtualization StorageClass is never created after CNV uninstall/reinstall.

Root cause: OCS only creates the virt StorageClass when the VirtualMachine CRD is present (ocs-operator PR #2076). After CNV reinstall, ocs-operator does not automatically reconcile to create the SC (BZ2322458). The existing workaround in deploy_cnv.sh restarts ocs-operator explicitly, but this only runs during initial deploy — not during the iuo-install test job's reinstall flow.

Why it passes sometimes: If ocs-storagecluster-ceph-rbd-virtualization exists as a leftover from a previous run where the restart was triggered, the fixture finds it immediately (false positive). A companion fix in cnv-qe-automation deletes the SC on CNV undeploy to prevent this.

Fix: Add restart_ocs_operator_for_virt_sc() to tests/install_upgrade_operators/product_install/utils.py. The helper waits for the ocs-operator pod to be available, deletes it with delete(wait=True) so the Deployment controller recreates it, then waits for replicas to recover. In default_storage_class_from_config, call this helper before the polling loop when the target SC is ocs-storagecluster-ceph-rbd-virtualization and it does not yet exist — triggering OCS reconciliation within the test instead of relying on external scripts.

Changes:

  • tests/install_upgrade_operators/product_install/utils.py: new restart_ocs_operator_for_virt_sc(admin_client) — uses ensure_exists=True on the ocs-operator Deployment (raises NotFound if absent), raises ResourceMismatch if replica count is zero, waits for the pod via TimeoutSampler, deletes it with delete(wait=True), then calls wait_for_replicas(timeout=TIMEOUT_10MIN). Pod deletion is used instead of clean_up() to avoid SKIP_RESOURCE_TEARDOWN interference.

  • tests/install_upgrade_operators/product_install/conftest.py: default_storage_class_from_config calls the helper conditionally before the 5-minute StorageClass poll.

  • utilities/unittests/test_storage.py: removes unit tests for the function that was previously in utilities/storage.py (now moved to product_install/utils.py).
  • ##### Which issue(s) this PR fixes:

    CNV-97297

    ##### Special notes for reviewer:

  • Pod deletion via delete(wait=True) is intentional over clean_up(): clean_up() respects SKIP_RESOURCE_TEARDOWN, which would silently skip the pod deletion during debug sessions and cause the test to hang.

  • The helper lives in product_install/utils.py (not utilities/storage.py) because it is only needed by the product install flow and has no reuse outside that context.

  • Companion fix: cnv-qe-automation commit 0ecbfd7c1 deletes ocs-storagecluster-ceph-rbd-virtualization on undeploy_cnv.sh to eliminate false-positive passes from leftover SCs.
  • ##### jira-ticket:

    CNV-97297

    🤖 Generated with Claude Code

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    Tests
    Installation and upgrade checks now handle a missing Ceph RBD virtualization storage class by restarting the storage operator and waiting for it to become available. Checks using other storage classes are unchanged. This improves the reliability of validation when the virtualization storage class is not present at the start of a check.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 451 lines (+338 / -113) across 5 files Reviewer: geetikakay Review duration: 44127m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.45) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 451 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.366
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #6304"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.4% (MEDIUM) · Higher = larger blast radius
    45.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 24.2% · Safe to merge
    24.2%