[libvirt] [RFC] Unify KVM kernel-space and user-space code into a single project

Daniel P. Berrange berrange at redhat.com
Fri Apr 9 14:45:52 UTC 2010


On Fri, Apr 09, 2010 at 03:31:37PM +0100, Antoine Martin wrote:
> [snip]
> >> * not everything is exposed via libvirt:
> >> virsh can retrieve vncdisplay
> >> but libvirt (or at least the python bindings) does not. How come?
> >> This happens to be one thing I need for writing a libvirt backend for my
> >> virtual desktop software.
> > 
> > The 'virsh vncdisplay' command is simply fetching the XML doc for the
> > guest and then extracting the VNC port using a xpath expression
> > 
> >    /domain/devices/graphics[@type='vnc']/@port
> > 
> > So for python you'd want to just get an XML handling module and do similar.
> Yes, I saw that in the virsh code.
> Shouldn't this be part of the libvirt api proper??
> Isn't it supposed to shield us from dealing with files and XML?

It isn't scalable to add APIs for extracting each possible piece of info
from the XML. All languages have APIs for extracting data from XML using
XPath (or DOM). Thus it is better to leave that flexibility to the apps
rather than hardcoding APIs for it in libvirt. The XML schemas/docs are
a formal part of the libvit API, so we're not trying to sheild that from
apps.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list