From Fedora Project Wiki

Description

Attach a CPU to a running VM.

Setup

Functioning virt host and VM created on F20+.

How to test

  • Launch virt-manager. Start with a shutoff VM. Verify that the guest has a 'Channel qemu-ga' device listed in its hardware details.
  • In Details->CPU, change the Max CPUs to 4 and the Current CPUs to 1. Note: there's a bug in virt-manager where it doesn't update the 'current vcpus' UI. But it does actually make the change.
  • Start the VM, log in, open a terminal and su - to get root.
  • Verify qemu-ga is running in the guest:
    ps axwww | grep qemu-ga
  • Verify only CPU is visible to the guest, this should only show 'cpu0': ls -d /sys/devices/system/cpu/cpu[0-9]
  • In virt-manager, change the current CPU allocation to 2, hit apply.
  • Back in the guest, run the 'ls' command again, you should now see cpu0 and cpu1.
  • Online the CPU with: echo 1 > /sys/devices/system/cpu/cpu1/online
  • Verify the CPU shows up in: cat /proc/cpuinfo

Note: Hot remove is not currently supported.

Expected Results

No obvious errors occur, all results are as indicated.

Additional info