QEMU KVM Libvirt手册(8): 半虚拟化设备virtio
KVM本身并不提供半虚拟化功能,是通过virtio来实现的
The benefits of virtio drivers are of lower overhead and higher performance.
Memory Ballooning (virtio_balloon)
memory ballooning可以动态调整guest的内存的大小
如果有-m参数,则向更大的内存调整时无效的,但是可以往小的里面调整
我们首先ssh到guest里面
ip netns exec qrouter-26a45e0e-a58a-443b-a972-d62c0c5a1323 ssh -i openstack.pem ubuntu@192.168.0.35
在虚拟机里面看内存的大小
ubuntu@testinject19:~$ free
total used free shared buffers cached
Mem: 2051748 478276 1573472 0 46620 345908
-/+ buffers/cache: 85748 1966000
Swap: 0 0 0
在Monitor上看balloon的大小
root:/home/cliu8# virsh qemu-monitor-command instance-00000024 --hmp "info balloon"
balloon: actual=2048
我们试图往大里调整
root:/home/cliu8# virsh qemu-monitor-command instance-00000024 --hmp "balloon 4096"
发现无效
root:/home/cliu8# virsh qemu-monitor-command instance-00000024 --hmp "info balloon"
balloon: actual=2048
ubuntu@testinject19:~$ free
total used free shared buffers cached
Mem: 2051748 478276 1573472 0 46628 345920
-/+ buffers/cache: 85728 1966020
Swap: 0 0 0
我们往小里调整内存
root:/home/cliu8# virsh qemu-monitor-command instance-00000024 --hmp "balloon 1024"
发现生效了
root:/home/cliu8# virsh qemu-monitor-command instance-00000024 --hmp "info balloon"
balloon: actual=1024
ubuntu@testinject19:~$ free
total used free shared buffers cached
Mem: 1003172 470796 532376 0 46636 345920
-/+ buffers/cache: 78240 924932
Swap: 0 0 0
有了balloon,如果guest需要更多的RAM,则可以给它增加一些内存。如果guest不需要那么多内存,可以通过balloon从中拿出一部分内存。这个过程,不需要启停虚拟机。
balloon driver像是一个特殊的process,运行在guest机器上,它可以扩大自己的内存,使得其他的应用程序的内存减少,也可以缩小内存,使得其他的应用程序内存增加。


guest中的balloon driver通过virtio channel和host进行交互,接收host发来的命令,比如发来的命令式减少内存,则balloon driver就扩大它的内存占有量。
然后balloon driver将自己占有的内存交回给host,使得host有了更多的内存。

对于libvirt而言,有currentMemory和maxMemory两种概念,maxMemory就是-m参数设定的,currentMemory就是balloon设定的。
Para-virtualized network interface cards (virtio_net)
-netdev tap,fd=32,id=hostnet0,vhost=on,vhostfd=37
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=fa:16:3e:d1:2d:99,bus=pci.0,addr=0x3
Para-virtualized block devices (virtio_blk)
-drive file=/var/lib/nova/instances/1f8e6f7e-5a70-4780-89c1-464dc0e7f308/disk,if=none,id=drive-virtio-disk0,format=qcow2,cache=none
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1
QEMU KVM Libvirt手册(8): 半虚拟化设备virtio的更多相关文章
- QEMU KVM Libvirt手册(7): 硬件虚拟化
在openstack中,如果我们启动一个虚拟机,我们会看到非常复杂的参数 qemu-system-x86_64 -enable-kvm -name instance-00000024 -S -mach ...
- QEMU KVM Libvirt手册(11): Managing Storage
When managing a VM Guest on the VM Host Server itself, it is possible to access the complete file sy ...
- QEMU KVM Libvirt手册(10):Managing Virtual Machines with libvirt
libvirt is a library that provides a common API for managing popular virtualization solutions, among ...
- QEMU KVM libvirt 手册(1): 安装
安装 对虚拟化的支持通常在BIOS中是禁掉的,必须开启才可以. 对于Intel CPU,我们可以通过下面的命令查看是否支持虚拟化. # grep "vmx" /proc/cpuin ...
- QEMU KVM libvirt手册(4) – images
RAW raw是默认的格式,格式简单,容易转换为其他的格式.需要文件系统的支持才能支持sparse file 创建image # qemu-img create -f raw flat.img 10G ...
- QEMU KVM libvirt 手册(3) - Storage Media
访问Hard Drive 使用-hda –hdb qemu-system-x86_64 -enable-kvm -name ubuntutest -m 2048 -hda ubuntutest.im ...
- QEMU KVM Libvirt手册(10): KVM的各种限制
Overcommits KVM allows for both memory and disk space overcommit. However, hard errors resulting fro ...
- QEMU KVM Libvirt手册(5) – snapshots
前面讲了QEMU的qcow2格式的internal snapshot和external snapshot,这都是虚拟机文件格式的功能. 这是文件级别的. 还可以是文件系统级别的,比如很多文件系统支持s ...
- QEMU KVM libvirt手册(2): monitor
Administrating Virtual Machines with QEMU Monitor When QEMU is running, a monitor console is provide ...
随机推荐
- Xshell 连接虚拟机出现 "The remote SSH server rejected X11 forwarding request"
1. 描述 虚拟机:VirtualBox Linux: centOS7 解决了 centOS7在VirtualBox中装好后的网络连接问题 后,用 Xshell 连接服务器时出现下面情况: 2. ss ...
- oracle ORA-00119, ORA-00132问题解决
使用PL/SQL登录oracle报ORA-12154: TNS: 无法解析指定的连接标识符sqlplus /nologconnect /as sysdbastartup报如下错误:ORA-00119: ...
- Nginx 静态页面POST 请求提示405 Not Allowed
从git上cp了一个开源的前端框架lay Ajax版本,用Nginx配置访问首页没问题 nginx配置如下: server { listen ; server_name adminhtml.com; ...
- IBOS云办公系统二次开发之功能介绍(PHP技术)
IBOS自动化办公系统是我见到的功能.架构最好的开源自动化办公系统,功能与企业需求吻合度之高.架构之灵活,让我不得不将之介绍给大家,让跟多需要学习PHP开发的朋友来了解她,拥抱她! 如果您还没有很好的 ...
- .net core 2.x - 发布到IIS
没啥写的,随便记录下 说明 与ASP.NET时代不同,ASP.NET Core不再是由IIS工作进程(w3wp.exe)托管,而是使用自托管Web服务器(Kestrel)运行,IIS则是作为反向代理的 ...
- 使用pl/sql developer登陆不了oracle
1,Oracle ORA12514 监听程序当前无法识别连接描述符中请求的服务 这里最主要的原因在于:(参考:https://www.cnblogs.com/shangshan/p/6359880.h ...
- 机器学习入门之sklearn介绍
SKlearn简介 scikit-learn,又写作sklearn,是一个开源的基于python语言的机器学习工具包.它通过NumPy, SciPy和Matplotlib等python数值计算的库实现 ...
- firefox添加post插件
附加组件 - > 插件 -> 搜索RESTClient
- VMware14 安装CentOS7 实现宿主机ping通虚拟机、虚拟机ping通宿主机、虚拟机能上网且能ping通百度
本文旨在通过通过虚拟机VMware14来安装CentOS7 系统,并配置固定IP来实现在Windows系统中使用Linux环境. 本文目录: 0.本机环境 1.VMware14 初始化 1.1.安装V ...
- VB中StdPicture尺寸(Width,Height)转像素单位
首先获得一个图片对象 Dim spic As StdPicture Set spic = LoadPicture("d:\0.bmp") '从文件获得 Set spic = Cli ...