Skip to content

fix(vm): revert migrated volumes when kvvmi is missing#2506

Open
yaroslavborbat wants to merge 2 commits into
feat/inplace-resizefrom
fix/vm/revert-volumes-without-kvvmi
Open

fix(vm): revert migrated volumes when kvvmi is missing#2506
yaroslavborbat wants to merge 2 commits into
feat/inplace-resizefrom
fix/vm/revert-volumes-without-kvvmi

Conversation

@yaroslavborbat

@yaroslavborbat yaroslavborbat commented Jun 17, 2026

Copy link
Copy Markdown
Member

Description

The fix restores migrated volumes in kvvm.spec when kvvmi is already missing.

It also fixes the VMBDA case: existing hotplug volumes are now rebuilt from the current VirtualDisk.Status.Target.PersistentVolumeClaim, so after migration rollback they no longer keep a stale target PVC in kvvm.spec.

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

A user could hit this during the following flow:

  • a VM uses at least one local-storage disk, including a disk attached through VMBDA;
  • VM eviction starts volume migration;
  • migration fails;
  • the user uncordons nodes and requests VM restart;
  • kvvmi is already deleted, while kvvm.spec still points to migrated target PVCs.

In that state KubeVirt sets ManualRecoveryRequired and refuses to start the VM. The controller could not revert volumes without kvvmi, and VMBDA hotplug volumes could also keep stale PVCs because they were preserved in kvvm.spec but not rebuilt from the current disk state.

This change makes the controller restore source PVCs in both cases, which unblocks VM recovery after failed migration.

What is the expected result?

Reproduce with a VM that has a local-storage disk, including a VMBDA-attached disk:

  • cordon all nodes;
  • start VM eviction;
  • wait until the eviction/migration operation fails;
  • uncordon nodes;
  • request VM restart.

Expected result:

  • migrated target PVCs are restored back to source PVCs in kvvm.spec;
  • VMBDA hotplug volumes are also rebuilt from the current PVC state;
  • ManualRecoveryRequired no longer blocks recovery in this case;
  • the VM starts again without manual kvvm.spec editing.

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: vm
type: fix
summary: "A VM can start again after a failed local-disk migration restart when `kvvmi` is already deleted and migrated volumes, including VMBDA-attached volumes, must be restored from target PVCs back to the current source PVCs."

Signed-off-by: Yaroslav Borbat <yaroslav.borbat@flant.com>
Signed-off-by: Yaroslav Borbat <yaroslav.borbat@flant.com>
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