How to pass QEMU command-line options through libvirt
来源:互联网 发布:分类信息网 软件 编辑:程序博客网 时间:2024/06/06 01:35
An entire virtual machine configuration can be passed on QEMU's extensive
command-line, including everything from PCI slots to CPU features to serial
port settings. While defining a virtual machine from a monster
command-line may seem insane, there are times when QEMU's rich command-line
options come in handy.
And at those times one wishes to side-step libvirt's domain XML and specify
QEMU command-line options directly. Luckily libvirt makes this possible and I
learnt about it from Daniel Berrange and Anthony Liguori on IRC. This libvirt
feature will probably come in handy to others and so I want to share it.
The <qemu:commandline> domain XML tag
There is a special namespace for QEMU-specific tags in libvirt domain XML. You
cannot use QEMU-specific tags without first declaring the namespace. To enable
it use the following:
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
修改:<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/2.0'>
Now you can add command-line arguments to the QEMU invocation. For example, to load an option ROM with-option-rom:
<qemu:commandline> <qemu:arg value='-option-rom'/> <qemu:arg value='path/to/my.rom'/></qemu:commandline>
添加qemu_log()支持:
<qemu:commandline>
<qemu:arg value='-d'/>
<qemu:arg value='unimp'/>
<qemu:arg value='-D'/>
<qemu:arg value='/tmp/qemu.log'/>
</qemu:commandline>
It is also possible to add environment variables to the QEMU invocation:
<qemu:commandline> <qemu:env name='MY_VAR' value='my_value'/></qemu:commandline>
Setting qdev properties through libvirt
Taking this a step further we can set qdev properties through libvirt. There is no domain XML for setting the virtio-blk-pci ioeventfd qdev property. Here is how to set it using <qemu:arg> and the -set QEMU option:
<qemu:commandline> <qemu:arg value='-set'/> <qemu:arg value='device.virtio-disk0.ioeventfd=off'/></qemu:commandline>
The result is that libvirt generates a QEMU command-line that ends with -set device.virtio-disk0.ioeventfd=off. This causes QEMU to go back and set the ioeventfd property of device virtio-disk0 to off.
More information
The following libvirt wiki page documents mappings from QEMU command-line options to libvirt domain XML. This is extremely useful if you know which QEMU option to use but are unsure how to express that in domain
XML.
That page also reveals the <qemu:commandline> tag and shows how it can be used to invoke QEMU with the GDB stub (-s).
- How to pass QEMU command-line options through libvirt
- How to pass QEMU command-line options through libvirt
- How to access the QEMU monitor through libvirt 如何访问由libvirt创建的qemu控制台qmp hmp
- How to pass macro definition from “makefile” command line arguments to C source code?
- 使用libvirt和qemu将pci pass through设备添加到虚拟机上
- OpenGL pass-through in QEMU
- Linker command-line options
- GCC Command-Line Options
- WinDbg Command-Line Options
- GCC Command-Line Options
- Know How to Use Command-line Tools
- Know How to Use Command-Line Tools
- How to parse command line parameters.
- CLP:Command Line Processor Options
- 6.1. Maven Command Line Options
- COBOL parsing command-line options
- How to run FTE and FTE from command line
- how to automate label printing with command line parameters
- 教程——基于HLS实现FIR滤波器
- 网络编程 select epoll
- ubuntu下安装XAMPP
- Quartz2D Paths 重要属性
- Timer的用法
- How to pass QEMU command-line options through libvirt
- Caffe+Ubuntu14.04+CUDA6.5新手安装配置指南
- LeetCode-Largest Number-解题报告
- Google Guava 类库简介
- 【swift-总结】结构体和类
- Linux 的虚拟文件系统(强烈推荐)
- 【数组】合并有序数列
- 滚动页面时DIV到达顶部时固定在顶部(jq实现)
- hdu 5224 Tom and paper