← Back to Pull requests

CherryPicked: [cnv-4.22] [IUO] Restart ocs-operator after CNV reinstall to create virt StorageClass #6750

Closed
unknown closed this pull request without merging on Nov 04, 2026 06:19 UTC
View on GitHub
unknown unknown commented on Oct 30, 2026 12:00 UTC
Author

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

Cherry-pick of #6304 to cnv-4.22.

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:

    https://issues.redhat.com/browse/CNV-97297

    Diff: 386 lines (+289 / -97) across 4 files Reviewer: hmeir Review duration: 6858m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 386 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.356
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #6750"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 43% (MEDIUM) · Higher = larger blast radius
    43%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 17% · Safe to merge
    17%