27
cpuindex cpuindex: Specifies a physical CPU by its index. To obtain the physical CPU index,
use the
display vmcpupin command.
Usage guidelines
If you bind multiple vCPUs of a VM to only one physical CPU, the VM might fail to start up because of
CPU resource conflict. As a best practice to ensure correct VM startup, bind the vCPUs to different
physical CPUs.
If you use this command on a running VM, you must restart the VM for the configuration to take effect.
If you use this command on a stopped VM, the configuration takes effect after you start the VM.
Examples
# Bind vCPUs 0 and 1 on VM centos7 to physical CPUs 2 and 3, respectively.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm]set vcpupin vm centos7 vcpuindex 0 cpuindex 2
[Sysname-vmm]set vcpupin vm centos7 vcpuindex 1 cpuindex 3
Related commands
display vmcpupin
set vcpu vm
Use set vcpu vm to set the number of vCPUs allocated to a VM.
Syntax
set vcpu vm vm-name vcpu-count vcpu-count
Views
VMM view
Predefined user roles
network-admin
Parameters
vm-name: Specifies a VM by its name. The vm-name argument is a case-sensitive string of 1 to 30
characters.
vcpu-count vcpu-count: Sets the number of vCPUs. The value range for the vcpu-count
argument depends on the number of CPUs on the device.
Usage guidelines
If you set the number of vCPUs allocated to a VM to 0, the VM will be inaccessible at the next startup.
To access the VM, you must reallocate vCPUs to the VM.
If you use this command on a running VM, you must restart the VM for the configuration to take effect.
If you use this command on a stopped VM, the configuration takes effect after you start the VM.
Examples
# Set the number of vCPUs to 2 for VM centos7.
<Sysname> system-view
[Sysname] vmm
[Sysname-vmm] set vcpu vm centos7 vcpu-count 2