Modifying the virtual CPU weight
Modify the share of run time that is assigned to a virtual server.
About this task
The available CPU time is shared between the running virtual servers. Each virtual server receives the share that is configured with the shares element, or the default value.
To display the current CPU weight of a virtual server, enter:
# virsh schedinfo <VS>
You can modify this share for a running virtual server or persistently across virtual server restarts.
Procedure
Example
- A virtual server with a CPU weight of 2048 receives twice as much run time as a virtual server with a CPU weight of 1024.
- The following example modifies the CPU weight of vserv1 to 2048
while it is running:
virsh schedinfo vserv1 --live cpu_shares=2048 Scheduler : posix cpu_shares : 2048 vcpu_period : 100000 vcpu_quota : -1 emulator_period: 100000 emulator_quota : -1
- The following example changes the libvirt-internal configuration,
which will persistently affect the CPU weight, beginning with the
next restart of vserv1.
virsh schedinfo vserv1 --config cpu_shares=2048 Scheduler : posix cpu_shares : 2048 vcpu_period : 0 vcpu_quota : 0 emulator_period: 0 emulator_quota : 0