Skip to content

KVM: register SystemVM templates as dynamically scalable - #14705

Open
andrijapanicsb wants to merge 2 commits into
apache:mainfrom
andrijapanicsb:kvm-systemvm-template-dynamic-scaling
Open

andrijapanicsb wants to merge 2 commits into
apache:mainfrom
andrijapanicsb:kvm-systemvm-template-dynamic-scaling

Conversation

@andrijapanicsb

@andrijapanicsb andrijapanicsb commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

In short

KVM SystemVM templates are now registered as dynamically scalable: on fresh installs, for new template versions, and on upgrade for the ones already there. CKS nodes use this template by default, so a running CKS cluster can then be scaled to a new offering live, as #13226 intended.

Fixes #14704.

Why

On a default install, scaling a running CKS cluster to a new offering fails with does not have tools to support dynamic scaling. CKS nodes inherit the template's dynamic-scaling flag, and the KVM SystemVM template never had it set. The flag dates from when it meant "XenServer/VMware tools are installed"; KVM needs no guest tools for CPU and memory hot-plug.

Changes

  • SystemVmTemplateRegistration.createTemplateObjectInDB sets dynamicallyScalable for KVM templates (the method is now protected so it can be unit tested).
  • schema-42300to2400.sql sets the flag on all existing KVM SystemVM templates. Installs upgraded across several releases keep several of them, and the SQL runs before the new template row is created, so both changes are needed.
  • SystemVmTemplateRegistration.updateRegisteredTemplateDetails sets the flag on a KVM template that an operator registered by hand before the upgrade. The upgrade SQL misses it, because it is still a user template at that point. Templates that are already SystemVM templates keep their flag, so a later upgrade does not undo an operator's choice.
  • Five unit tests: a new KVM template is registered as scalable and a VMware one is not; a KVM template registered by hand becomes scalable when it turns into a SystemVM template, a VMware one does not, and an existing KVM SystemVM template keeps its flag.

What changes for operators

Situation Before After
enable.dynamic.scale.vm off (the default) Nothing is dynamically scalable Unchanged
Global setting on, new CKS nodes Not scalable; live CKS scaling fails Scalable; live CKS scaling works
Global setting on, new routers, SSVM, console proxy Fixed size Scalable; about 67 MB less usable memory (a 64 MB kernel I/O buffer for the hot-plug range)
VMs that already exist — Unchanged; each keeps its own flag until it is recreated

Testing

  • Unit tests: all five new tests in SystemVmTemplateRegistrationTest pass.
  • Live, on standard x86_64 KVM hosts with the template flag set by hand (details in CKS: running clusters cannot be scaled live on a default install, because the KVM SystemVM template is not dynamically scalable #14704): a running CKS cluster scaled live with no reboot. The memory cost was measured on routers, SSVM and console proxy. A VM whose vCPU maximum exceeds the machine type limit is refused by libvirt and CloudStack reports the error without crashing.
  • Still to do on packages built from this PR: a fresh install, and an upgrade from 4.20 / 4.22 / 4.23 checking that every KVM SystemVM template row ends up with the flag set, including one registered by hand before the upgrade.

CKS nodes use the KVM SystemVM template by default and inherit its
dynamic-scaling flag, which was never set, so a running CKS cluster
could not be scaled to a new offering. Set the flag when a KVM SystemVM
template is registered, and on upgrade for the existing ones.

Fixes apache#14704
@andrijapanicsb

Copy link
Copy Markdown
Contributor Author

@ACSHomeBot package G

@ACSHomeBot

ACSHomeBot commented Nov 15, 2026 •

Copy link
Copy Markdown

Accepted: package kvm G for 4ea5d5b1fc96.

Planned: RPM + DEB, KVM SystemVM.

Status: Completed. Packaging results.

@codecov

codecov Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 20.77%. Comparing base (c5bd11a) to head (8758799).

Additional details and impacted files
@@            Coverage Diff            @@
##               main   #14705   +/-   ##
=========================================
  Coverage     20.77%   20.77%           
- Complexity    20855    20857    +2     
=========================================
  Files          6053     6053           
  Lines        548230   548234    +4     
  Branches      73237    73239    +2     
=========================================
+ Hits         113903   113909    +6     
+ Misses       420988   420986    -2     
  Partials      13339    13339           
Flag Coverage Δ
uitests 3.86% <ø> (ø)
unittests 22.21% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ACSHomeBot

Copy link
Copy Markdown

Packaging results:

Result Artifact Platform Build Time
PASS RPM EL (EL8/9/10) 30 min
PASS DEB Ubuntu, Debian 22 min

Test packages are available at:

…namically scalable

An operator can register the new SystemVM template by hand before upgrading. The upgrade SQL
runs while it is still a user template, so it does not set the flag. Set it when such a KVM
template is turned into a SystemVM template. Templates that already are SystemVM templates keep
their flag, so a later upgrade does not undo an operator's choice.
@andrijapanicsb

Copy link
Copy Markdown
Contributor Author

@ACSHomeBot package G

@ACSHomeBot

ACSHomeBot commented Nov 15, 2026 •

Copy link
Copy Markdown

Accepted: package kvm G for 8758799f1b64.

Planned: RPM + DEB, KVM SystemVM.

Status: Completed. Packaging results.

@ACSHomeBot

Copy link
Copy Markdown

Packaging results:

Result Artifact Platform Build Time
PASS RPM EL (EL8/9/10) 29 min
PASS DEB Ubuntu, Debian 21 min

Test packages are available at:

This branch has not been deployed

No deployments
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.

CKS: running clusters cannot be scaled live on a default install, because the KVM SystemVM template is not dynamically scalable

2 participants