Configuring the VM
Use the virsh edit vmx command to edit the VM configuration file. In the command, vmx indicates the VM name. Note that the modification takes effect after the VM is stopped and then started.
Binding VM CPUs
Bind the vCPUs of the VM to the physical CPUs of an NUMA node.
The following describes how to bind the four vCPUs of a VM to physical cores 0, 1, 2, and 3 respectively.
- Open the configuration file in edit mode.
1virsh edit vmx
- Add the following CPU information to the file:
1 2 3 4 5 6 7
<cputune> <vcpupin vcpu='0' cpuset='0'/> <vcpupin vcpu='1' cpuset='1'/> <vcpupin vcpu='2' cpuset='2'/> <vcpupin vcpu='3' cpuset='3'/> <emulatorpin cpuset='0-3'/> </cputune>

After the configuration, the vCPU threads of the VM run on the physical CPU of the specified host.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Check the CPU basic information.
1virsh vcpuinfo vmx
Binding Memory
Bind the memory to the same
- Open the configuration file in edit mode.
1virsh edit vmx
- Add the following memory information to the file:
1 2 3
<numatune> <memory mode='strict' nodeset='0'/> </numatune>

- Press Esc, type :wq!, and press Enter to save the file and exit.
Parent topic: Installing VMs