[libvirt] PATCH: Generic internal API for domain XML parser/formatter

Daniel P. Berrange berrange at redhat.com
Tue Jun 24 16:34:13 UTC 2008

On Tue, Jun 24, 2008 at 04:34:11PM +0100, Daniel P. Berrange wrote:
> We currently have five drivers which handle the domain XML containing
> duplicated parsers and formatters for the XML with varying degrees of
> buginess, and often very similar structs. This patch introduces a new
> general purpose internal API for parsing and formatting network XML, 
> and representing it as a series of structs.
> This code is derived from the current equivalent code in the QEMU driver
> for domains, but with alot of extra config parsing added for stuff needed
> by the Xen drivers. I have not yet added the extra bits needed by the
> container based drivers, LXC and OpenVZ, but don't anticipate any problems
> in this regard.

I should also point out one new feature in the domain XML format I added
while doing this change. 

In the <graphics> element for VNC we have a 'port' attribute. For a running
VM this contains the actual port number. For an inactive VM it contains
the pre-allocated fixed port number, or -1 to indicate that a automatically
allocated port should be used.

There is an obvious flaw here - if the VM is running it is impossible to
tell if its port was fixed or automatically allocated.

So I introduce an extra attribute    autoport='no|yes'  to provide this
data. For compatability we still use port='-1' when the VM is not running

We also never finished the data for SDL display types. These need to track
the X display adddress, along with a path for a XAuth file. So I added
two attributes  display=':0.0' and xauth='/root/.Xauthority' to make this
work. The xen driver uses this  info, and we can make it work for QEMU
too, though my current patch doesn't do this

|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.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