[libvirt-users] C code to generate domain XML

Eric Blake eblake at redhat.com
Thu Mar 19 22:27:40 UTC 2015

On 03/19/2015 02:50 PM, Parvathi wrote:
> Hi,
> Are there any C code (in libvirt) to generate domain XML like the one we
> supply to virsh?

As to your direct question, yes, libvirt.git contains code to generate
domain XML - when you do something like 'virsh edit', you are doing a
round trip of libvirtd generating XML, virsh displaying it for you to
edit, virsh handing your edits back to libvirtd, and libvirtd parsing
the edited XML.  The libvirtd side of that lives in
src/conf/domain_conf.c and friends.

But it sounds like you may be asking a higher-level question not about
libvirtd's internals but about what other client softward can use to
ease its own management of XML.  You may be interested in the
libvirt-glib project.  Here's a blog entry with more details:


In particular, the libvirt-gconfig subproject deals with C code (and
other language bindings) for more easily generating libvirt XML within
the framework of glib's GObject classes.

Eric Blake   eblake 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: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20150319/0607e5ea/attachment.sig>

More information about the libvirt-users mailing list