[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