Skip to content

fix(vm): cleanup cpu.features on KVVM after vmclass change#2352

Merged
diafour merged 3 commits into
mainfrom
fix/vm/remove-cpu-features-from-kvvm-on-vmclass-type-change
May 19, 2026
Merged

fix(vm): cleanup cpu.features on KVVM after vmclass change#2352
diafour merged 3 commits into
mainfrom
fix/vm/remove-cpu-features-from-kvvm-on-vmclass-type-change

Conversation

@diafour
Copy link
Copy Markdown
Member

@diafour diafour commented May 15, 2026

Description

  • reset cpu.features when generate KVVM

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

The problem occurs when VM started with Discovery type vmclass and then vmclass is changed to a non-Discovery type. - cpu.features are kept and they are passed to a nodeSelector for VM Pod. User may encounter unexpected Pod scheduling problems after vmclass change.

What is the expected result?

No cpu.features in KVVM when change Discovery vmclass to a non-Discovery vmclass, e.g. Model.

VM classes:

vmclass/generic

  spec:
    cpu:
      model: Nehalem
      type: Model

vmclass/discovery

    cpu:
      discovery:
        nodeSelector: {}
      type: Discovery

VM state

$ kubectl get vm testvm -o jsonpath='{.spec.virtualMachineClassName}'
discovery

$ kubectl get intvirtvm testvm -o jsonpath='{"Model: "}{.spec.template.spec.domain.cpu.model}{"\n"}{"Features: "}{.spec.template.spec.domain.cpu.features }'

Model: qemu64
Features: [{"name":"aes","policy":"require"},....,{"name":"svm","policy":"optional"}]

$ kubectl patch vm testvm --type merge -p '{"spec":{"virtualMachineClassName":"generic"}}'

Before:

$ kubectl get intvirtvm testvm -o jsonpath='{"Model: "}{.spec.template.spec.domain.cpu.model}{"\n"}{"Features: "}{.spec.template.spec.domain.cpu.features }'

Model: Nehalem
Features: [{"name":"aes","policy":"require"},....,{"name":"svm","policy":"optional"}]

After:

$ kubectl get intvirtvm testvm -o jsonpath='{"Model: "}{.spec.template.spec.domain.cpu.model}{"\n"}{"Features: "}{.spec.template.spec.domain.cpu.features }'

Model: Nehalem
Features: 

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 possible scheduling problems after changing vmclass from Discovery type to Model type.

@diafour diafour added this to the v1.9.0 milestone May 15, 2026
@diafour diafour self-assigned this May 15, 2026
The problem occurs when VM started with Discovery type vmclass and then vmclass is changed to a non-Discovery type. - cpu.features are kept and they are passed to a nodeSelector for VM Pod. User may encounter unexpected Pod scheduling problems after vmclass change.

Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
@diafour diafour force-pushed the fix/vm/remove-cpu-features-from-kvvm-on-vmclass-type-change branch from e7bb0f0 to 3a192d2 Compare May 18, 2026 12:01
diafour added 2 commits May 18, 2026 19:29
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
@diafour diafour requested a review from danilrwx May 18, 2026 17:37
@diafour diafour merged commit 5864b6e into main May 19, 2026
29 of 30 checks passed
@diafour diafour deleted the fix/vm/remove-cpu-features-from-kvvm-on-vmclass-type-change branch May 19, 2026 07:28
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