CherryPicked: [cnv-4.22] [IUO] Restart ocs-operator after CNV reinstall to create virt StorageClass #6750
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
hmeir
##### What this PR does / why we need it:
Cherry-pick of #6304 to
cnv-4.22.test_default_storage_class_setfails intermittently (~60%) intest-cnv-4.22-iuo-install-productionbecauseocs-storagecluster-ceph-rbd-virtualizationStorageClass is never created after CNV uninstall/reinstall.Root cause: OCS only creates the virt StorageClass when the
VirtualMachineCRD is present (ocs-operator PR #2076). After CNV reinstall,ocs-operatordoes not automatically reconcile to create the SC (BZ2322458). The existing workaround indeploy_cnv.shrestartsocs-operatorexplicitly, 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-virtualizationexists as a leftover from a previous run where the restart was triggered, the fixture finds it immediately (false positive). A companion fix incnv-qe-automationdeletes the SC on CNV undeploy to prevent this.Fix: Add
restart_ocs_operator_for_virt_sc()totests/install_upgrade_operators/product_install/utils.py. The helper waits for theocs-operatorpod to be available, deletes it withdelete(wait=True)so the Deployment controller recreates it, then waits for replicas to recover. Indefault_storage_class_from_config, call this helper before the polling loop when the target SC isocs-storagecluster-ceph-rbd-virtualizationand 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: newrestart_ocs_operator_for_virt_sc(admin_client)— usesensure_exists=Trueon theocs-operatorDeployment (raisesNotFoundif absent), raisesResourceMismatchif replica count is zero, waits for the pod viaTimeoutSampler, deletes it withdelete(wait=True), then callswait_for_replicas(timeout=TIMEOUT_10MIN). Pod deletion is used instead ofclean_up()to avoidSKIP_RESOURCE_TEARDOWNinterference.tests/install_upgrade_operators/product_install/conftest.py:default_storage_class_from_configcalls the helper conditionally before the 5-minute StorageClass poll.utilities/unittests/test_storage.py: removes unit tests for the function that was previously inutilities/storage.py(now moved toproduct_install/utils.py).##### Which issue(s) this PR fixes:
CNV-97297
##### Special notes for reviewer:
delete(wait=True)is intentional overclean_up():clean_up()respectsSKIP_RESOURCE_TEARDOWN, which would silently skip the pod deletion during debug sessions and cause the test to hang.product_install/utils.py(notutilities/storage.py) because it is only needed by the product install flow and has no reuse outside that context.cnv-qe-automationcommit0ecbfd7c1deletesocs-storagecluster-ceph-rbd-virtualizationonundeploy_cnv.shto eliminate false-positive passes from leftover SCs.##### jira-ticket:
https://issues.redhat.com/browse/CNV-97297