virsh命令可以随时更改虚拟机的内存大小,不需要重启虚拟机。
调整云主机内存大小。
查看云主机列表:
[root@compute ~]# virsh list --all Id Name State ---------------------------------------------------- 5 instance-0000001c running查看内存大小:
[root@compute ~]# virsh dommemstat instance-0000001c actual 2097152 (实际内存大小2G,单位KB) swap_in 0 swap_out 0 major_fault 413 minor_fault 1890551 unused 1867228 available 2049288 rss 563304登录云主机查看:
[root@node1 ~]# free -h total used free shared buff/cache available Mem: 2.0G 65M 1.8G 16M 114M 1.8G Swap: 0B 0B 0B调节内存大小为1G:
>>>1*1024*1024 1048576 [root@compute ~]# virsh setmem --size 1048576 instance-0000001c