Skip to content

fix(vm): fix affinity when migrating VM with local disks#2508

Open
loktev-d wants to merge 8 commits into
mainfrom
fix/vm/local-disk-migration-affinity
Open

fix(vm): fix affinity when migrating VM with local disks#2508
loktev-d wants to merge 8 commits into
mainfrom
fix/vm/local-disk-migration-affinity

Conversation

@loktev-d

@loktev-d loktev-d commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes intermittent unschedulable migration of VMs with local-storage disks attached via VMBDA. Three coordinated changes:

  1. state.go (resolvePVCName / PVNodeAffinityTerms) — during a volume migration, derive the VM pod's node affinity from the migration target, never the source PVC's bound node.
  2. migration_volumes.go (SyncVolumes) — when volumes are already synced but the affinity drifted, re-patch it.
  3. kvvm_utils.go (syncAttachedVMBDAHotplugVolumes) — skip disks that are migrating, leaving their hotplug volume to the migration flow. Prevents the main sync from reverting the hotplug volume to the source PVC.

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

Migrating a VM with local disks attached through VMBDA failed intermittently . The migration target pod was pinned to the source node — KubeVirt copies the VM-pod node affinity and forbids the source node via anti-affinity, so the pod was unschedulable and the migration timed out.

What is the expected result?

A VM with VMBDA-attached local-storage disks evicts/migrates reliably

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: fix affinity when migrating VM with local disks

yaroslavborbat and others added 3 commits June 18, 2026 12:26
Signed-off-by: Yaroslav Borbat <yaroslav.borbat@flant.com>
Signed-off-by: Yaroslav Borbat <yaroslav.borbat@flant.com>
Signed-off-by: Daniil Loktev <lokt.daniil@gmail.com>
loktev-d added 3 commits June 18, 2026 20:27
Signed-off-by: Daniil Loktev <lokt.daniil@gmail.com>
Signed-off-by: Daniil Loktev <lokt.daniil@gmail.com>
Signed-off-by: Daniil Loktev <lokt.daniil@gmail.com>
@loktev-d loktev-d added this to the v1.9.1 milestone Jun 19, 2026
Signed-off-by: Daniil Loktev <lokt.daniil@gmail.com>
@loktev-d loktev-d added the e2e/run Run e2e test on cluster of PR author label Jun 19, 2026
@deckhouse-BOaTswain

deckhouse-BOaTswain commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Workflow has started.
Follow the progress here: Workflow Run

The target step completed with status: failure.

@deckhouse-BOaTswain deckhouse-BOaTswain removed the e2e/run Run e2e test on cluster of PR author label Jun 19, 2026
@danilrwx danilrwx force-pushed the fix/vm/revert-volumes-without-kvvmi branch from 744d6ca to ed05fc2 Compare June 19, 2026 09:47
Base automatically changed from fix/vm/revert-volumes-without-kvvmi to main June 19, 2026 09:55
Signed-off-by: Daniil Loktev <70405899+loktev-d@users.noreply.github.com>
@loktev-d loktev-d added the e2e/run Run e2e test on cluster of PR author label Jun 19, 2026
@deckhouse-BOaTswain

deckhouse-BOaTswain commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Workflow has started.
Follow the progress here: Workflow Run

The target step completed with status: failure.

@deckhouse-BOaTswain deckhouse-BOaTswain removed the e2e/run Run e2e test on cluster of PR author label Jun 19, 2026
@loktev-d loktev-d added the e2e/run Run e2e test on cluster of PR author label Jun 19, 2026
@deckhouse-BOaTswain

deckhouse-BOaTswain commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Workflow has started.
Follow the progress here: Workflow Run

The target step completed with status: failure.

@deckhouse-BOaTswain deckhouse-BOaTswain removed the e2e/run Run e2e test on cluster of PR author label Jun 19, 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.

3 participants