Skip to content

kubevirt-csi depends on the deprecated HotplugVolumes gate for VMI-level detach #4032

Description

What this tracks

KubeVirt v1.9.0 marks the HotplugVolumes feature gate Deprecated ("replaced by DeclarativeHotplugVolumes"). The platform keeps it enabled on purpose (#4015), because kubevirt-csi detaches tenant volumes through the VMI-level removevolume subresource, and virt-api accepts that call on a VM-owned VMI only while HotplugVolumes is on: vmiVolumePatch checks ephemeralHotplugSupported(), which is exactly HotplugVolumesEnabled() (pkg/virt-api/rest/volumes.go). Our wrapper calls RemoveVolumeFromVMI at packages/apps/kubernetes/images/kubevirt-csi-driver/controller.go:455, and upstream kubevirt/csi-driver has the same fallback in removeVolumeFromVm for the case where the VM is already gone during teardown.

Upstream names no removal release. Its Deprecated state says "discontinued in the following release" in a doc comment, but MultiArchitecture and DisableMDEVConfiguration have been deprecated since 1.8.0 and are still registered at 1.9.0, so the state is a direction, not a date. When HotplugVolumes does become Discontinued, the VMI-level detach path stops working and tenant volume detach breaks during control-plane teardown.

While the gate stays enabled it also keeps DeclarativeHotplugVolumes inert: handleDeclarativeVolumeHotplug in pkg/virt-controller/watch/vm/vm.go returns early when HotplugVolumesEnabled(). So anything that wants declarative hotplug (dataVolume.hotpluggable: true in a VM spec) waits on the same change.

What has to happen before the gate can go

Move kubevirt-csi off the VMI-level removevolume: detach through the VM subresource while the VM exists, and for the teardown race handle the orphaned hotplug attachment pod without the VMI subresource (delete the attachment pod, or wait for the VMI to finish terminating). Then drop HotplugVolumes from the static featureGates in packages/system/kubevirt/templates/kubevirt-cr.yaml, which also switches declarative hotplug on.

Check the pinned release's pkg/virt-config/featuregate/inactive.go at every KubeVirt bump for the state of this gate.

Activity

  1. added
    kind/cleanupCategorizes issue or PR as related to cleanup of code, process, or technical debt
    area/virtualizationIssues or PRs related to virtualization (kubevirt, cdi, vmi, vm-import)
    on Sep 2, 2026
  2. lexfrei commented on Sep 6, 2026

    @lexfrei
    ContributorAuthor

    Filed upstream as kubevirt/csi-driver#381.

    Worth correcting the framing here while I am at it: the VMI-level detach is not a cozystack deviation. Upstream removeVolumeFromVm calls RemoveVolumeFromVM first and only drops to RemoveVolumeFromVMI when the volume is not in VM.spec, which is the teardown case. So the dependency on HotplugVolumes lives in the driver, and moving off it is upstream work rather than something this repo can patch around.

    Separate finding from the same read, which deserves its own issue rather than being folded in here: the local wrapper in packages/apps/kubernetes/images/kubevirt-csi-driver/controller.go documents itself as a backport of kubevirt/csi-driver#184, to be dropped once that merges and the module is bumped past it. Both conditions are met. #184 merged on 2026-06-24 and go.mod pins that exact commit. Whether the wrapper is now fully redundant needs a behaviour diff, since it adds a VMI status check and EnsureVolumeRemoved on top of what upstream does.

  3. added
    triage/acceptedIndicates an issue is ready to be actively worked on
    priority/backlogGeneral backlog priority. Lower than priority/important-longterm
    upstream-issueRequires resolving an issue in an upstream project
    and removed
    triage/needs-triageIndicates an issue needs triage by a maintainer
    on Sep 23, 2026
  4. added a commit that references this issue on Oct 6, 2026
    bcda5c8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/virtualizationIssues or PRs related to virtualization (kubevirt, cdi, vmi, vm-import)kind/cleanupCategorizes issue or PR as related to cleanup of code, process, or technical debtpriority/backlogGeneral backlog priority. Lower than priority/important-longtermtriage/acceptedIndicates an issue is ready to be actively worked onupstream-issueRequires resolving an issue in an upstream project

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions