Skip to content

Show libvirt vCPUs as cores of one processor - #46

Open
nel wants to merge 1 commit into
NetwindHQ:mainfrom
nel:libvirt-cpu-topology
Open

nel wants to merge 1 commit into
NetwindHQ:mainfrom
nel:libvirt-cpu-topology

Conversation

@nel

@nel nel commented Oct 29, 2026 •

Copy link
Copy Markdown

Summary

A VM with cpus: 10 running Windows 11 reports only 2 CPUs (NUMBER_OF_PROCESSORS=2).

Without a <topology> element, libvirt shows each vCPU to the guest as a separate physical processor with one core, so cpus: 10 looks like a machine with ten single-core processors. Windows 10 and 11 (Home, Pro, Enterprise) use at most two physical processors, so the guest uses two cores and ignores the rest. Linux guests use every vCPU either way.

This shows the vCPUs as one processor with cpus cores:

<cpu mode='host-passthrough'>
  <topology sockets='1' cores='{{.CPUs}}' threads='1'/>
</cpu>

In libvirt's terms, sockets is the number of physical processors. The VM still has the same number of vCPUs; only the layout the guest sees changes.

Closes #49

Test plan

  • Template test checks the topology
  • make test, golangci-lint run (2.15.0), gofmt -s
  • Windows 11 guest with cpus: 10 on Ubuntu 26.04 / libvirt 12.0.0: 2 CPUs before, 10 after

Without a topology, libvirt shows each vCPU to the guest as a separate
processor with one core. Windows 10 and 11 use at most two processors,
so a VM with cpus: 10 ran on 2. The domain now shows one processor with
cpus cores.
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.

libvirt: Windows guests use only 2 of the configured vCPUs

1 participant