[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] Questions about the schemas



On Mon, Feb 18, 2013 at 08:54:35AM -0500, Gene Czarcinski wrote:
> This is not in any way critical but simply trying to get a better
> idea of the purposes of docs/schemas/*
> 
> I recently submitted a patch which needed me to look at and modify
> some of the schema files [adding a client-id specification to
> dhcp/host].  As I looked them over I wondered what the purpose was
> of the schemas.  If you ran virt-xml-validate (which uses xmllint)
> and the result is that your file is not validated, then there is a
> problem but it is not clear just what the problem is.  On the other
> hand, if you run virt-xml-validate and it says the your file is OK
> (validated), that only means that it did not find a problem but not
> that the file is OK.
> 
> For example, the schema says it is valid to specify an IPv6 address
> in an IPv4 definition.  The implementing software if kick it out but
> the schema says it is OK.
> 
> Another example is the (host) name under the dhcp/host definition.
> The current schema says this is required but dnsmasq does not
> require a host-name specification [I submitted a trivial patch to
> make it optional].
> 
> So, if the purpose is to kick out obvious errors, this it is OK as
> is.  If the purpose to to be definitiive, then more work needs to be
> done.
> 
> My opinion is that the current situation is "good enough" as long as
> valid elements/specifications are not treated as errors.

The schemas are intended to provide a simple "syntax check" for XML
documents that an app has created. eg detect typos in element/attribute
names, or use of elements which don't use or incorrect nesting of
elements. Even for syntax checks though, the schemas a not going to
provide 100% coverage - todo so would make the schemas far more complicated
and it is just not worth the effort. The XML parser is the ultimate
place where 100% complete syntax checks are performed.

What they generally do not do, is provide any kind of "semantic check"
about whether the configuration actually makes sense. For example, the
schema won't tell you that requesting virtio disks with a vmware guest
is semantically invalid. This is left to the virt driver.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]