[libvirt] ignore vs. error when inappropriate or unrecognized attributes/elements are present in XML

Daniel P. Berrange berrange at redhat.com
Tue Aug 16 20:58:29 UTC 2011


On Tue, Aug 16, 2011 at 03:29:04PM -0400, Laine Stump wrote:
> On 08/16/2011 11:47 AM, Daniel P. Berrange wrote:
> >On Tue, Aug 16, 2011 at 04:44:42AM -0400, Laine Stump wrote:
> >>This is related to: https://bugzilla.redhat.com/show_bug.cgi?id=638633#c14
> >>
> >>I had started to reply to it in the comments of the bug, but my
> >>reply became too long, and expanded into an issue wider than that
> >>single bug, so I figured I'd better discuss it here instead.
> >[snip]
> >
> >>Actually, I can see now there are several different classes of this
> >>problem. Here are the first few that come to mind:
> >>
> >>1) an attribute/element is completely unknown/unexpected in all
> >>cases (e.g. "frozzle='fib'" anywhere, or more insidious, something
> >>that *looks* correct, but isn't, e.g. "<script
> >>name='/path/to/script'/>"*)
> >RNG schema validation is the only sane way to catch this
> 
> 
> Agreed.
> 
> 
> >>2) an attribute/element is useful/expected only when some other
> >>attribute is set to a particular value (usually one called "type",
> >>but could be something else), for example keymap='blah' is only
> >>expected in a<graphics>  element when type='spice' or type='vnc'.
> >We should always catch these when parsing, since this is done
> >via our enumeration helpers.
> 
> 
> "Enumeration helpers"? My brain isn't making the connection to what
> you're talking about... :-)
> 
> 
> >>3) an attribute/element is useful/expected only for certain
> >>combinations of the value of some other attribute and which driver
> >>is using the element, e.g. the subject of this bug - script='blah'
> >>is only expected when type='bridge' and it's used by the Xen driver,
> >>or type='ethernet' and it's used by the qemu driver.
> >IMHO this is just another case of 1) really.
> 
> I guess as long as the hypervisor being used is part of the XML, and
> the RNG is detailed enough to note that, eg, when the hypervisor is
> xen and the interface type is bridge, a script element is okay, or
> when the hypervisor is qemu and the interface type is ethernet, a
> script is okay, but not in other cases. Wouldn't an RNG file that
> adequately described that be fairly gigantic and filled with
> redundancies, though?

Forgot to mention that the RNG schemas shouldn't contain hypervisor
specific conditionals. For cases where the XML is valid, but the
config is not supported by the driver in question, should report a
VIR_ERR_CONFIG_UNSUPPORTED error

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 :|




More information about the libvir-list mailing list