Skip to content

fix(vm): tolerate missing hotplug image during attach#2578

Closed
danilrwx wants to merge 1 commit into
mainfrom
fix/hotplug-image-tolerate-missing
Closed

fix(vm): tolerate missing hotplug image during attach#2578
danilrwx wants to merge 1 commit into
mainfrom
fix/hotplug-image-tolerate-missing

Conversation

@danilrwx

@danilrwx danilrwx commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description

Reverts #2574 and fixes the same issue with a smaller, builder-only change.

While an image is being hotplugged via VMBDA, KubeVirt adds the volume to KVVM before the
device shows up in the VM .status.blockDeviceRefs. In that window the builder maps don't
contain the image yet, and setVMBDABlockDeviceDisk failed the whole reconcile with
... image "<name>" should exist in the cluster; please recreate it.

Fix: in the VirtualImage/ClusterVirtualImage branches, skip the disk when the image is not in
the maps yet — the volume is already present and options are applied on a later reconcile.
This mirrors the already-tolerant VirtualDisk branch. Skip (not removeDisk): an attached
image is finalizer-protected, so a missing entry means the status lagged, not that the image
is gone.

Why this instead of #2574: #2574 pre-fetched VMBDA-referenced objects into the builder maps
(~120 lines + extra API Gets per reconcile). This achieves the same result with two guards in
the one function that actually errors, no new API calls, and no reliance on how the block
device status handler reads the maps.

Why do we need it, and what problem does it solve?

The image exists and is Ready, but the reconcile still errors during the attach window. It
self-heals, yet spams error logs and causes requeue/backoff churn (and e2e flakiness). This
removes those false failures. Attach speed is unchanged.

What is the expected result?

Hotplug an image (VI/CVI) to a running VM: no more image "<name>" should exist in the cluster
errors during the attach; the VMBDA reaches Attached and the VM status converges cleanly.

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

section: core
type: fix
summary: Do not fail VM reconcile while a hotplug image is being attached via VMBDA.
impact_level: low

@danilrwx danilrwx changed the title Fix/hotplug image tolerate missing fix(vm): tolerate not-yet-resolved hotplug image in KVVM builder Jul 2, 2026
@danilrwx danilrwx changed the title fix(vm): tolerate not-yet-resolved hotplug image in KVVM builder fix(vm): tolerate missing hotplug image during attach Jul 2, 2026
Temporarily build 3p-kubevirt from fix/hotplug-cdisk-teardown-unmount to
verify the hotplug container-disk teardown unmount fix on the cluster, and
bust the werf install cache so the branch is re-cloned.

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx force-pushed the fix/hotplug-image-tolerate-missing branch from aeec3cb to 808f79d Compare July 2, 2026 14:44
@danilrwx danilrwx closed this Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant