mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-06 03:57:52 +09:00
## What this PR does During node reprovisioning in tenant Kubernetes clusters, the VMI (and its hot-plug pod) can outlive the parent VirtualMachine. The upstream kubevirt-csi-driver treats a missing VM as "detach succeeded", so the hot-plug pod stays alive and keeps the infra storage device exclusively attached to the source host — every subsequent attach of that volume fails, on DRBD with `failed to set source device readwrite`. This was hit repeatedly in production tenant clusters (see kubevirt/csi-driver#182). This PR: - updates the pinned `kubevirt.io/csi-driver` module to the latest upstream commit; - backports kubevirt/csi-driver#184 into the controller wrapper: after the upstream unpublish returns success, the wrapper re-checks `VMI.status.volumeStatus` and, if the hot-plug is still reported there (e.g. because the parent VM is already gone), detaches it from the VMI directly via the `removevolume` subresource and waits until it disappears. The backport is self-contained in the wrapper and can be dropped once kubevirt/csi-driver#184 merges upstream and the module pin is bumped past it. Credit to @mattia-eleuteri for the root-cause analysis and the upstream fix. ### Screenshots Not a UI change. ### Release note ```release-note fix(csi): tenant CSI driver no longer leaves orphan hot-plug volumes exclusively attached to the source host when the VMI outlives its deleted VirtualMachine during node reprovisioning ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Enhanced hotplug volume unpublishing with automatic verification to ensure volumes are fully detached before completion, including retry logic with up to 2-minute timeout. * **Dependencies** * Updated KubeVirt API and CSI driver dependencies to latest versions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
How to test packages local
cd packages/core/installer
make image-cozystack REGISTRY=YOUR_CUSTOM_REGISTRY
make apply
kubectl delete po -l app=source-controller -n cozy-fluxcd