Repository navigation
fix(kubevirt-cdi): drop global cloneStrategyOverride - #2921
IvanHunters wants to merge 1 commit into
Conversation
The CDI CR pinned cloneStrategyOverride to csi-clone globally (introduced with the golden-disks feature, switched from snapshot to csi-clone afterwards). That override bypassed CDI's same-StorageClass guard, so a cross-StorageClass clone (e.g. a vm-disk created from a golden image in a replicated StorageClass into a node-local one) was issued as csi-clone and could never satisfy on the target driver: the temporary clone PVC stayed unbound forever and no error surfaced. Drop the override and let CDI pick the clone strategy per StorageProfile. The same-class path still goes through CSI-snapshot clones (fast); the cross-class path falls back to host-assisted copy (slow but correct). Closes #2908 Signed-off-by: IvanHunters <[email protected]>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
NOT LGTM (REQUEST_CHANGES)
Business context: this drops the global cloneStrategyOverride: csi-clone on the CDI CR so the clone strategy is chosen per StorageProfile, aiming to fix vm-disks that stay unbound when a golden image is cloned into a different StorageClass (#2908).
Dropping a global override that forces one strategy for every backend is a reasonable direction. The problem is that the stated mechanism is wrong for the storage backend this repo ships, and the change is not shown to fix the reported case.
Blocker
- Removing the override does not make cross-StorageClass clones fall back to host-assisted copy for the reported LINSTOR case, so the fix is unverified against #2908.
The PR body, the release note, and the new code comment (cdi-cr.yaml:6-12) all state that without the override, cross-StorageClass clones "fall back to host-assisted copy". That is not what CDI v1.64.0 does — the version this chart deploys (quay.io/kubevirt/cdi-controller:v1.64.0) — when source and target StorageClasses share one CSI driver, which is exactly the reported scenario: replicated and local are both linstor.csi.linbit.com.
What CDI actually does with the override gone:
- The strategy is read from the target StorageProfile's
Status.CloneStrategy. LINSTOR is not in CDI's clone-strategy advisory table, so CDI defaults the profile tosnapshotbecause this repo ships a default VolumeSnapshotClass for the driver. Evidence:pkg/controller/clone/planner.gocomputeStrategyForSourcePVC(strategy defaultCloneStrategySnapshot, then taken from the StorageProfile);pkg/storagecapabilities/storagecapabilities.goCloneStrategyByProvisionerKeyhas nolinstor.csi.linbit.comentry;packages/system/linstor/templates/volumesnapshotclass.yaml(linstor-snapshots,is-default-class: true). - The planner only falls back to host-assisted when source and target do not share a CSI driver, have incompatible volume modes, lack a compatible VolumeSnapshotClass, or the target cannot expand. It never compares StorageClass names. For
replicated->local(same driver, same snapshot class, same volume mode) none of these fire. Evidence:pkg/controller/clone/planner.govalidateAdvancedClonePVC;pkg/controller/clone/common.goGetCommonDriverandGetCompatibleVolumeSnapshotClass(both compare provisioner, not StorageClass name).
So removing the override changes the cross-class strategy from csi-clone to snapshot, not to host-assisted copy. Whether a snapshot-based clone of a golden image into a node-local (placement count 1) StorageClass actually binds is not established — it can stay unbound for the same root reason as csi-clone (the target volume is provisioned on a node that does not hold the source data). The "Verification" section only runs helm template to confirm the field is gone; it does not exercise a real replicated->local clone. Evidence: PR description "Verification" block.
Please verify the actual failing scenario with the override removed (create a vm-disk from a golden image into local and confirm it binds), and correct the description, the code comment, and the release note to match the strategy CDI actually selects. If the snapshot path also stays unbound, override removal alone does not fix #2908 and a different approach is needed — e.g. an explicit per-StorageClass cloneStrategy, or a fail-fast / warning in vm-disk when the target StorageClass differs from the golden image's (the second direction suggested in #2908).
Non-blocking
- Description history is inaccurate: the body says the override was "switched from
snapshottocsi-clonein 42778cf", but it was introduced ascopy(d38c8aa) and 42778cf switchedcopy->csi-clone.snapshotwas never the global value. Evidence:git show 42778cf4bandgit show d38c8aa5aonpackages/system/kubevirt-cdi/templates/cdi-cr.yaml. - Nothing pins the intent. This chart ships no helm-unittest, and
make updatere-fetchestemplates/cdi-cr.yamlfrom upstream, which would silently restore an override if upstream ever set one. A test assertingspec.cloneStrategyOverrideis absent would lock the change. Evidence:packages/system/kubevirt-cdihas notests/directory;packages/system/kubevirt-cdi/Makefilewget ... -O templates/cdi-cr.yaml.
| # replicated StorageClass into a node-local one) were issued as csi-clone | ||
| # and could never satisfy on the target driver — the PVC stayed unbound. | ||
| # Per-StorageProfile selection lets CSI-snapshot clones stay fast for the | ||
| # same-class case while falling back to host-assisted copy across classes. |
There was a problem hiding this comment.
This is the claim that does not hold for the reported LINSTOR case. With the override gone, replicated->local (both linstor.csi.linbit.com) is resolved as snapshot, not host-assisted copy: the planner only falls back when the two StorageClasses do not share a CSI driver / snapshot class / volume mode — it never compares StorageClass names. Evidence: pkg/controller/clone/planner.go validateAdvancedClonePVC and pkg/controller/clone/common.go GetCommonDriver (provisioner-only); linstor.csi.linbit.com is absent from CloneStrategyByProvisionerKey, so the profile defaults to snapshot via the shipped default VolumeSnapshotClass. See the review summary.
|
This PR has had no activity for 60 days and was marked |
What this PR does
packages/system/kubevirt-cdi/templates/cdi-cr.yamlpinnedcloneStrategyOverride: csi-cloneon the CDI CR globally (introduced with the golden-disks feature, switched fromsnapshottocsi-clonein 42778cf).That override bypassed CDI's same-StorageClass guard: CDI's snapshot-based smart-clone path checks that source and target PVCs share a StorageClass and falls back to host-assisted copy otherwise, but the csi-clone path has no such guard — Kubernetes allows cross-StorageClass PVC cloning at the API level and delegates satisfiability to the CSI driver. Forced csi-clone was therefore issued as-is for every clone, including cross-class ones.
The concrete failure (#2908): a
vm-diskcreated from a golden image (which lives in a replicated StorageClass) into alocal(node-local, placement count 1) StorageClass — CDI emits atmp-pvc-…incozy-publicwith the target StorageClass and aprep-…pod, butlocalcannot materialise the clone on a node that does not already hold the source data. The PVC stays unbound forever, LINSTOR CSI logscontext deadline exceeded, and no error is surfaced to the user.This PR removes the global override so CDI picks the clone strategy per
StorageProfile. The same-class path still uses CSI-snapshot clones (fast); the cross-class path falls back to host-assisted copy (slow but correct).Verification
The CRD schema in
packages/system/kubevirt-cdi-operator/templates/cdi-operator.yamlstill documents thecloneStrategyOverridefield — that is the CRD definition, not its value, and remains unchanged.Performance and behavioural implications
snapshotfor any StorageProfile whose CSI driver advertisesVolumeSnapshotsupport (e.g. LINSTOR).snapshot, aStorageProfileCR withcloneStrategy: csi-clonefor that class would restore the previous fast path without re-introducing the cross-class bug. None are shipped today and none are required by this PR.Release note
Closes #2908