[libvirt PATCH 0/3] cpu: Make unknown XML elements fail CPU comparison

Daniel P. Berrangé berrange at redhat.com
Wed Sep 16 13:48:08 UTC 2020


On Wed, Sep 16, 2020 at 03:33:53PM +0200, Tim Wiederhake wrote:
> We currently ignore unknown elements in the CPU XML description, e.g. with vi=
> rsh
> cpu-compare and hypervisor-cpu-compare. This makes '<cpu><faeture name=3D"...=
> "/></cpu>'
> (note the typo in "faeture") semantically identic to '<cpu/>'. No error is re=
> ported.

This is an intentional implementation choice in libvirt. The XML documents
that we're parsing are way to large and complex for us to justify adding
code to report errors for every invalid attribute or child element name.

We provide an RNG schema, however, which declares the valid set of attrs
and thus by running RNG schema validation, a client can get a error report
of invalid info.

We enable this validation by default in "virsh edit" and a few other
similar commands.

There are certainly libvirt APIs though which accept XML and don't have
a flag defined to enable RNG schema validation. I presume the CPU APIs
are one such case.  We should add support for validation to all such
APIs accepting XML documents, and wire it up in virsh.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list