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:
https://www.berrange.com/posts/2011/11/22/introducing-the-libvirt-glib-a-mapping-of-the-libvirt-api-and-xml-to-glibgobject/
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