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

Re: [libvirt] [PATCH 0/8] Add XML validation to the APIs



On Tue, Nov 18, 2014 at 05:59:47PM +0000, Daniel P. Berrange wrote:
This proof of concept patch extends the virDomainDefineXML
and virDomainCreateXML APIs so that they can validate
the user supplied XML document against the RNG schemas.

The virsh command will enable validation by default, it
must be turned off with --skip-validation if desired.

This series is not complete

- The network, interface, storage pool, etc APIs are
  not wired up to support validation.
- Only the QEMU virt driver is wired up to validate
- The virsh edit command is not wired up to validate

It is enough to demonstrate it working with 'virsh define'
and the QEMU driver though.

The biggest problem I see is the really awful error
messages we get back from libxml2 when validation
fails :-( They are essentially useless :-(


This is one of the things why I'm not convinced this work is worth
it.  It may be nice if we tell the user their XML is invalid instead
of silently losing information.  But error message similar to "invalid
element in interleave" doesn't help much when you are adding 100-line
XML.  There are some better validators, but requiring those would be
too cumbersome.

That said, I'm not _against_ this idea, I'm just thinking out loud.
Maybe we could create some descriptive mapping schema between
XML <-> internal structures and then simplify our parsing to error out
on unknown data if a flag is present.  However, that's something the
code is not prepared to do now.

Other than that, with this series applied, I get some errors with make
check, particularly these:

qemuxml2xmltest
openvzutilstest
cpuset
define-dev-segfault
read-non-seekable
read-bufsiz

Most of those are due to the test driver not supporting the new flag:

error: unsupported flags (0x1) in function testDomainDefineXMLFlags

Martin

Attachment: signature.asc
Description: Digital signature


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