Skip to content

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

Open
diafour wants to merge 1 commit into
mainfrom
fix/vm/remove-cpu-features-from-kvvm-on-vmclass-type-change
Open

fix(vm): cleanup cpu.features on KVVM after vmclass change#2352
diafour wants to merge 1 commit 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.

vmclass/generic

  spec:
    cpu:
      model: Nehalem
      type: Model

vmclass/discovery

    cpu:
      discovery:
        nodeSelector: {}
      type: Discovery


$ 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.
- [x] Changes were tested in the Kubernetes cluster manually.


## Changelog entries
<!---
  /!\ See CONTRIBUTING.md for more details. /!\
  Examples:
  ```changes
  section: core
  type: feature
  summary: "Node restarts can be avoided by pinning a checksum to a node group in config values."
  ---
  section: core
  type: fix
  summary: "Nodes with outdated manifests are no longer provisioned on *InstanceClass update."
  impact_level: high
  impact: |
    Expect nodes of "Cloud" type to restart.
  ---
  impact_level: low

-->

section: vm
type: fix
summary: Fix possible scheduling problems after changing vmclass from Discovery type to Model type.

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 added this to the v1.9.0 milestone May 15, 2026
@diafour diafour self-assigned this May 15, 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.

1 participant