]> git.ipfire.org Git - thirdparty/libvirt.git/commit
config: report error when script given for inappropriate interface type
authorLaine Stump <laine@laine.org>
Fri, 6 Jan 2012 17:59:47 +0000 (12:59 -0500)
committerLaine Stump <laine@laine.org>
Sun, 8 Jan 2012 15:52:24 +0000 (10:52 -0500)
commit1734cdb9951690cc9f13e371e301c3747c7b8777
tree71a44ea40576fd19a42fead8b14f402d1de3e652
parent13a776ca0dd7e8c23a9b18a90e577ad9b05ffe64
config: report error when script given for inappropriate interface type

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=638633

Although scripts are not used by interfaces of type other than
"ethernet" in qemu, due to the fact that the parser stores the script
name in a union that is only valid when type is ethernet or bridge,
there is no way for anyone except the parser itself to catch the
problem of specifying an interface script for an inappropriate
interface type (by the time the parsed data gets back to the code that
called the parser, all evidence that a script was specified is
forgotten).

Since the parser itself should be agnostic to which type of interface
allows scripts (an example of why: a script specified for an interface
of type bridge is valid for xen domains, but not for qemu domains),
the solution here is to move the script out of the union(s) in the
DomainNetDef, always populate it when specified (regardless of
interface type), and let the driver decide whether or not it is
appropriate.

Currently the qemu, xen, libxml, and uml drivers recognize the script
parameter and do something with it (the uml driver only to report that
it isn't supported). Those drivers have been updated to log a
CONFIG_UNSUPPORTED error when a script is specified for an interface
type that's inappropriate for that particular hypervisor.

(NB: There was earlier discussion of solving this problem by adding a
VALIDATE flag to all libvirt APIs that accept XML, which would cause
the XML to be validated against the RNG files. One statement during
that discussion was that the RNG shouldn't contain hypervisor-specific
things, though, and a proper solution to this problem would require
that (again, because a script for an interface of type "bridge" is
accepted by xen, but not by qemu).
src/conf/domain_conf.c
src/conf/domain_conf.h
src/libxl/libxl_conf.c
src/qemu/qemu_command.c
src/qemu/qemu_domain.c
src/qemu/qemu_driver.c
src/qemu/qemu_hotplug.c
src/uml/uml_conf.c
src/vbox/vbox_tmpl.c
src/xenxs/xen_sxpr.c
src/xenxs/xen_xm.c