Skip to content

docs: add CPU and memory hotplug how-to for virtual machines#979

Merged
fanzy618 merged 6 commits into
masterfrom
docs/vm-cpu-memory-hotplug
Jul 24, 2026
Merged

docs: add CPU and memory hotplug how-to for virtual machines#979
fanzy618 merged 6 commits into
masterfrom
docs/vm-cpu-memory-hotplug

Conversation

@fanzy618

@fanzy618 fanzy618 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a how-to under virtualization/virtual_machine/how_to/ covering CPU and memory hotplug for running VMs, based on live verification on an ACP 4.4 test cluster (HCO v4.4.3 / KubeVirt v1.8.4) with CentOS 7.9, Ubuntu 20.04, Debian 13, and Windows Server 2022 guests. Two review rounds have been incorporated; every corrected statement was re-verified against the shipped KubeVirt v1.8.4 source and/or live tests.

Key verified findings documented:

  • Every hotplug is delivered via one automatic live migration (LiveUpdate rollout strategy); the real prerequisite is LiveMigratable=True — RWX is required for PVC/DataVolume-backed disks only.
  • maxSockets / maxGuest are auto-computed at VMI start when omitted (default 4×, configurable); explicit values remain recommended.
  • CPU hotplug: hypervisor-side hot-add worked on all four tested guests; RHEL-family and Windows Server 2022 use the new vCPUs automatically, Ubuntu/Debian need a manual online or a udev rule (provided in the doc).
  • Memory hotplug (virtio-mem): the gate is guest support for the UNPLUGGED_INACCESSIBLE feature — upstream kernel 5.16+, but distributions backport independently (RHEL 9.4+ and 8.10 work — though 8.10 is hot-plug only by default; Ubuntu 22.04 GA 5.15 does not). Windows Server 2022 works once the viomem driver from the platform's virtio-win ISO (0.1.266) is installed — verified live 8Gi→10Gi online; without it the request stays silently pending and applies cold on the next restart.
  • Scaling down: memory can be requested down to the boot-time value online (best-effort — completion depends on the guest freeing the memory; a partial, error-free stall was reproduced under memory pressure). Below the boot value, and any CPU socket reduction, set RestartRequired.
  • Console-created (resources-only) VMs: adding memory.guest alone is applied live; the first addition of a cpu block requires one restart, and a combined patch suppresses the live memory path too.

Validation

  • yarn lint — 0 errors / 0 warnings
  • yarn build — passed
  • Live tests on the 4.4 cluster for every behavioral claim (hotplug, partial shrink under pressure, Windows viomem install, resources-only first-resize matrix)

🤖 Generated with Claude Code

https://claude.ai/code/session_018wp7GTjNPrAwPJpzmHNgn5

fanzy618 and others added 2 commits July 22, 2026 08:47
Verified live on CentOS 7.9 / Ubuntu 20.04 / Debian 13 guests: hotplug is
delivered via automatic live migration; CPU auto-online is RHEL-only;
memory hotplug (virtio-mem) needs guest kernel 5.16+ (QEMU requires
UNPLUGGED_INACCESSIBLE), pending requests apply on next restart;
reductions set RestartRequired.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…plug

VMs sized via resources.requests/limits (the web console form) lack the
cpu/memory spec fields; adding them is a non-live-updatable change that
sets RestartRequired. Verified live.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploying alauda-container-platform with  Cloudflare Pages  Cloudflare Pages

Latest commit: bee468c
Status: ✅  Deploy successful!
Preview URL: https://f631fff1.alauda-container-platform.pages.dev
Branch Preview URL: https://docs-vm-cpu-memory-hotplug.alauda-container-platform.pages.dev

View logs

fanzy618 and others added 4 commits July 23, 2026 03:01
CPU hotplug: hot-added vCPUs are used immediately (verified on Standard
edition, live session). Memory hotplug: no Windows virtio-mem driver
exists — the device sits in Device Manager with a driver error and the
request stays pending until a cold restart. Also document cancelling a
pending memory request by reverting memory.guest.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…iomem, per-resource first resize

All six review findings verified against the shipped KubeVirt v1.8.4 source
and re-tested on a live cluster before rewriting:

- Memory CAN be scaled down live as long as the target stays >= guestAtBoot
  (verified Debian 13 4Gi->3Gi and Windows 10Gi->9Gi->8Gi online); only going
  below the boot value sets RestartRequired. CPU reduction still always does.
- Windows memory hotplug WORKS once the viomem driver from the platform's
  virtio-win ISO (0.1.266 ships viomem for 2k16-2k25) is installed — verified
  live 8Gi->10Gi with pnputil-installed driver. Rewrote the 'no Windows
  driver' claim and added install instructions.
- First resize of a console-created (resources-only) VM: adding memory.guest
  alone is live; only adding the cpu block needs one restart — and a combined
  patch suppresses the live memory path too (all three cases verified).
- maxSockets/maxGuest are auto-computed at VMI start when omitted; reworded
  the contradictory 'must declare before start' prerequisite.
- Replaced the bare 'kernel 5.16+' rule with feature-negotiation guidance:
  distro kernels backport independently (RHEL 9.4+/8.10 work; Ubuntu 22.04 GA
  5.15 does NOT — corrected the previous 22.04+ recommendation).
- RWX prerequisite scoped to PVC/DataVolume-backed disks with LiveMigratable
  as the real gate; dmesg troubleshooting no longer equates 'no output' with
  'kernel too old'.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018wp7GTjNPrAwPJpzmHNgn5
…st policy, scope claims to tested guests

- Memory scale-down reworded as a best-effort request: accepted live (no
  RestartRequired at >= guestAtBoot) but completion depends on the guest
  freeing the memory. Verified live: under artificial memory pressure a
  Debian 13 shrink stalled at ~2.1Gi of a 2Gi request with no error, and
  ~86Mi stayed unreclaimable even after the pressure was removed.
- Debian's automatic memory onlining attributed to the image's kernel
  policy (auto_online_blocks=online, verified in-guest), not to the
  virtio-mem driver; added the check command.
- Troubleshooting split by direction: guestRequested>guestCurrent (driver/
  feature/onlining) vs guestRequested<guestCurrent (unmovable/locked pages,
  may never fully complete, not an error).
- CPU guidance scoped to the four tested guests; Windows limited to
  Windows Server 2022 with a note that CPU hot-add depends on
  dynamic-hardware-partitioning support in specific SKUs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018wp7GTjNPrAwPJpzmHNgn5
…r states, verified-vs-documented scope

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018wp7GTjNPrAwPJpzmHNgn5
@fanzy618
fanzy618 merged commit 25449ab into master Jul 24, 2026
2 checks passed
@fanzy618
fanzy618 deleted the docs/vm-cpu-memory-hotplug branch July 24, 2026 09:11
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