On Mon, Sep 26, 2022 at 12:56:44 +0100, Daniel P. Berrangé wrote:
On Fri, Sep 23, 2022 at 05:42:13PM +0200, Peter Krempa wrote:
> Introduce a new config option 'xml_validator' into the daemon config
> file which will allow users to make libvirt daemons use a custom XML
> validator.
>
> The rationale is that validators such as 'jing'[1] provide drastically
> better error specification when compared to the native libxml2 validator
> we use. A drawback though is that jing is written in Java and thus
> unusable by libvirt directly and also not a popular package present in
> distros.
>
> For power users and developers it still is worth having this feature to
> provide better errors in a native way.
I kinda wonder if those users need it integrated in libvirt
though, as opposed to just calling jing themselves when
needed. It feels like a fairly narrow set of users benefitting
here from this change, made even smaller by the fact that those
users have to remember to reconfigure libvirt to enable this.
Well, it makes it much more convenient when dealing with XML which is
not on disk, such as when doing a 'virsh edit' or editing the XML in
virt-manager's XML edit pane.
That way you don't have to go back to the edit window and copy-out the
XML and then run a validator.
[...]
>
> Example script to make this feature work with jing:
>
> #!/bin/bash
> java -jar /home/pipo/git/jing-trang/build/jing.jar $1 /dev/stdin 2>&1 ||
exit 1
>
> [1]
https://github.com/relaxng/jing-trang
To me this is only compelling if there's an option we can reasonably
wire up out of the box.
Well, I unfortunately didn't yet find any validator that I would
consider plugging in by default. Specifically in this case the overhead
of running a JVM is definitely not something I'd want do even if jing
were a widely distributed validator.