[root@ubuntu ~]# virsh vcpucount centos_server01 maximum config 2 maximum live 2 current config 2 current live 2
[root@ubuntu ~]# virsh setvcpus centos_server01 --maximum 4 --config [root@ubuntu ~]# virsh vcpucount centos_server01 maximum config 4 maximum live 2 current config 2 current live 2
配置最大CPU个数限制须要重启后才能生效
ps: --maximum must be used with --config onlyshell
[root@ubuntu ~]# virsh setvcpus centos_server01 --count 4 --config [root@ubuntu8 ~]# virsh vcpucount centos_server01 maximum config 4 maximum live 2 current config 4 current live 2
虚拟机CPU在maximum live的限制内,能够经过--live参数直接生效ubuntu
CPU能够在限制内热添加,但没法热减小,只能使用--config配置好后,等下次重启生效:centos
[root@ubuntu ~]# virsh setvcpus centos_server01 --count 2 --live error: internal error: cannot change vcpu count of this domain