Skip to content

fix(vm): resolve VMBDA-attached images during hotplug window#2574

Merged
danilrwx merged 2 commits into
mainfrom
fix/hotplug-image-resolve-race
Jul 2, 2026
Merged

fix(vm): resolve VMBDA-attached images during hotplug window#2574
danilrwx merged 2 commits into
mainfrom
fix/hotplug-image-resolve-race

Conversation

@danilrwx

@danilrwx danilrwx commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description

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 short window the KVVM builder
can't find the image and fails the whole reconcile with ... image "<name>" should exist in the cluster; please recreate it.

Fix: resolve VMBDA-attached images/disks that aren't in the refs yet, so the builder can set
their disks instead of aborting. Scoped to the KVVM builder only — readiness and finalizer
logic are untouched.

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.

The KVVM builder resolves block device images from maps built out of
.spec/.status blockDeviceRefs, while the VMBDA-driven volume sync iterates
the VMBDA list. During a hotplug attach KubeVirt adds the volume to KVVM
before the device appears in .status.blockDeviceRefs, so the freshly
attached image is missing from the maps and setBlockDeviceDisk aborts the
whole reconcile with "image should exist in the cluster".

Fill the builder maps with VMBDA-referenced images/disks not yet reflected
in the refs. Scoped to the KVVM builder call site so block device readiness
and finalizer logic are unaffected.

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
Assert ResolveVMBDAAttachedDevices fills the builder maps with images and
disks referenced by VMBDAs that are missing from the block device refs, and
tolerates a VMBDA whose image does not exist.

Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx marked this pull request as ready for review July 2, 2026 10:38
@danilrwx danilrwx added this to the v1.10.0 milestone Jul 2, 2026
@danilrwx danilrwx merged commit c25700b into main Jul 2, 2026
40 of 47 checks passed
@danilrwx danilrwx deleted the fix/hotplug-image-resolve-race branch July 2, 2026 10:50
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.

2 participants