Cole Robinson: Easy qemu commandline passthrough with virt-xml


Libvirt has supported qemu commandline option passthrough for qemu/kvm VMs for quite a while. The format for it is a bit of a pain though since it requires setting a magic xmlns value at the top of the domain XML. Basically doing it by hand kinda sucks.

In the recently released virt-manager 1.4.1, we added a virt-install/virt-xml option –qemu-commandline that tweaks option passthrough for new or existing VMs. So for example, if you wanted to add the qemu option string ‘-device FOO’ to an existing VM named f25, you can do:

  ./virt-xml f25 –edit –confirm –qemu-commandline=”-device FOO”

The output will look like:

--- Original XML
+++ Altered XML
@@ -1,4 +1,4 @@
-<domain type="kvm">
+<domain xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0" type="kvm">
<name>f25</name>
<uuid>9b6f1795-c88b-452a-a54c-f8579ddc18dd</uuid>
<memory unit="KiB">4194304</memory>
@@ -104,4 +104,8 @@
<address type="pci" domain="0x0000" bus="0x00" slot="0x0a" function="0x0"/>
</rng>
</devices>
+ <qemu:commandline>
+ <qemu:arg value="-device"/>
+ <qemu:arg value="foo"/>
+ </qemu:commandline>
</domain>

Define 'f25' with the changed XML? (y/n):


Source From: fedoraplanet.org.
Original article title: Cole Robinson: Easy qemu commandline passthrough with virt-xml.
This full article can be read at: Cole Robinson: Easy qemu commandline passthrough with virt-xml.

Advertisement


Random Article You May Like

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*