Skip to content

fix(vm): sync unschedulable KVVM on vmclass placement change#2177

Open
danilrwx wants to merge 1 commit intomainfrom
fix/vm/sync-kvvm-vmclass
Open

fix(vm): sync unschedulable KVVM on vmclass placement change#2177
danilrwx wants to merge 1 commit intomainfrom
fix/vm/sync-kvvm-vmclass

Conversation

@danilrwx
Copy link
Copy Markdown
Contributor

@danilrwx danilrwx commented Apr 1, 2026

Description

Fix synchronization of internal KubeVirt VM when the VM is in Unschedulable state and placement-related settings are changed via VMClass.

The workaround path in SyncKvvmHandler now treats these change paths as placement policy updates:

  • virtualMachineClassName
  • VirtualMachineClass:spec.nodeSelector
  • VirtualMachineClass:spec.tolerations

This allows controller to apply KVVM update and recycle launcher pod for unschedulable cases.

Also added unit tests for placement-path detection in isPlacementPolicyChanged.

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

When VM pod creation fails and KVVM stays Unschedulable, changing VMClass (for example, discovery -> generic) did not trigger full KVVM resync for placement-dependent fields.
As a result, domain.cpu / tolerations could stay stale and VM remained stuck.

This change makes unschedulable recovery react to VMClass-driven placement changes.

What is the expected result?

  1. Put VM into Unschedulable state.
  2. Change VMClass name or update VMClass spec.nodeSelector / spec.tolerations.
  3. Verify KVVM is synchronized and VM can leave Unschedulable when constraints become schedulable.

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: "Fix KVVM resync for unschedulable VMs when VMClass placement settings are changed."

@danilrwx danilrwx modified the milestones: v1.7.0, v1.8.0 Apr 1, 2026
@danilrwx danilrwx marked this pull request as ready for review April 1, 2026 14:13
Signed-off-by: Daniil Antoshin <daniil.antoshin@flant.com>
@danilrwx danilrwx force-pushed the fix/vm/sync-kvvm-vmclass branch from 86a4bbf to 0690a4d Compare April 1, 2026 14:13
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