[libvirt] How to add custom tag to the libvirt xml file for a new feature of the VM

Eric Blake eblake at redhat.com
Tue Jun 5 14:18:35 UTC 2012


On 06/05/2012 04:42 AM, Yashwanth K P wrote:
> Hello,
> 
> I am working on libvirt development and I wanted to add a custom tag to
> the libvirt xml to add a new feature to the VM. I am having trouble
> getting started with this. It would be really helpful if you can help me
> get started with this and guide me on what part of the source code that
> has to be modified to achieve the goal.

It would help if we knew more information about what you wanted.

Are you asking for how to add an extra command line argument to qemu?
If so, we already have a way to add custom arguments as an interim
measure until official domain XML is enhanced to support the argument
directly; see http://libvirt.org/drvqemu.html#qemucommand
Also, knowing _what_ command line argument you are adding in the interim
would help us know whether we need to focus on getting it into the
official XML sooner rather than later.

Are you asking for how to add arbitrary XML that does not affect the
qemu command line generated by libvirt, but which lets you associate
additional custom information with each domain?  If so, libvirt already
supports that via domain description (freeform) and metadata (xml
namespace sub-elements); see
http://libvirt.org/formatdomain.html#elementsMetadata

Are you asking for how to extend the supported domain XML to code in a
new feature?  If so, it may help to browse existing commits that have
added new XML.  For example, commit 988e85a added a <codec> sub-element
for controlling sound devices, followed by commit a7675a6 to wire up
qemu to use that new XML.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120605/656e0997/attachment-0001.sig>


More information about the libvir-list mailing list