[libvirt] Versioning/Compatibility in the XML schemas

Daniel Veillard veillard at redhat.com
Mon Feb 25 12:43:00 UTC 2013


On Mon, Feb 25, 2013 at 01:13:37PM +0100, Pieter Hollants wrote:
> Out of curiosity, seeing that we doing modifications to the XML
> schema all the time, there does not seem to be some sort of version
> identifier in the XML schemas.
> 
> If I take the recently merged patch for DHCP options, for instance,
> suppose virt-manager would add support for it in its GUI. How would
> such a network XML definition be interpreted by older libvirt
> versions? Is it supposed to ignore elements it doesn't know or do we
> have an implicit requirement of "always use the latest versions
> together"?

  The base principle is that we are supposed to only do "additions"
i.e. an XML which was RNG valid for a version A should still be valid
for the RHN shipped with version B , B >= A. And an older version of
the code usually still work with a newer XML instance.

  There had been some small breakage IIRC but usually thise rule works.
In general the way it works is that we don't validate XML input, but we
convert it to an internal data structure by picking the information we
know about. So the parser from A may extract only the subset it knows
about. The "danger" is that it will accept XML definition without fully
understanding the semantic of all elements, instead of filing to load
it. It is usually acceptable, the problem is for example when the
discarded elements includes security or features really needed for
proper work.
  One thing which will fail commonly is that if we add an extra value
for an attribute, usually we use macro mapping the text value in the XML
to an internal enum, and if the match can't be done, you get an error.
So we tend to fail on unknow attribute values, but accept unknown
element most of the time.

Daniel

-- 
Daniel Veillard      | Open Source and Standards, Red Hat
veillard at redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list