标签:kvm
改变CPU和内存的配置可以通过编辑VM定义的XML文件或者使用libvrit工具。root@kvm:~# virsh dommemstat kvm1
actual 1048576
swap_in 0
rss 333644
root@kvm:~# virsh setmem kvm1 --size 1049000
root@kvm:~# virsh destroy kvm1
Domain kvm1 destroyed
root@kvm:~# virsh setmaxmem kvm1 --size 2097152
root@kvm:~# virsh start kvm1
Domain kvm1 started
root@kvm:~# virsh dommemstat kvm1
actual 2097152
swap_in 0
rss 214408
root@kvm:~# virsh console kvm1
Connected to domain kvm1
Escape character is ^]
Debian GNU/Linux 8 debian ttyS0
debian login: root
Password:
...
root@debian:~# free -m
total used free shared buffers cached
Mem: 2010 93 1917 5 8 40
-/+ buffers/cache: 43 1966
Swap: 382 0 3 82
root@kvm:~# virsh dumpxml kvm1 | grep memory
<memory unit=‘KiB‘>2097152</memory>
root@kvm:~# virsh vcpuinfo kvm1
VCPU: 0
CPU: 29
State: running
CPU time: 9.7s
CPU Affinity: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
root@kvm:~# virsh vcpucount kvm1
maximum config 1
maximum live 1
current config 1
current live 1
root@kvm:~# virsh edit kvm1
...
<vcpu placement=‘static‘>4</vcpu>
...
Domain kvm1 XML configuration edited.
root@kvm:~# virsh vcpucount kvm1
maximum config 4
maximum live 4
current config 4
current live 4
root@kvm:~# virsh dumpxml kvm1 | grep -i cpu
<vcpu placement=‘static‘>4</vcpu>
标签:kvm
原文地址:http://blog.51cto.com/aishangwei/2124521