openstack云主机内存热调节 2019-05-25

    xiaoxiao2023-12-24  23

    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

    查看:

    [root@compute ~]# virsh dommemstat instance-0000001c actual 1048576 swap_in 0 swap_out 0 major_fault 414 minor_fault 1899451 unused 817228 available 1000712 rss 556476 [root@node1 ~]# free -h total used free shared buff/cache available Mem: 977M 65M 797M 16M 114M 787M Swap: 0B 0B 0B
    最新回复(0)