On 01/06/2012 11:16 AM, Laine Stump wrote:
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).
The idea for a VALIDATE flag is still independently useful, but I agree
with your assessment that it would not fix this particular case, because
the .rng does not distinguish between hypervisor-specific restrictions.
+++ b/src/qemu/qemu_domain.c
@@ -1167,10 +1167,12 @@ void qemuDomainObjCheckNetTaint(struct qemud_driver *driver,
virDomainNetDefPtr net,
int logFD)
{
- if ((net->type == VIR_DOMAIN_NET_TYPE_ETHERNET &&
- net->data.ethernet.script != NULL) ||
- (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE &&
- net->data.bridge.script != NULL))
+ /* script is only useful for NET_TYPE_ETHERNET (qemu) and
+ * NET_TYPE_BRIDGE (xen), but could be (incorrectly) specified for
+ * any interface type. In any case, it's adding user sauce into
+ * the soup, so it should taint the domain.
Unusual that the comment mentions xen from inside the qemu directory,
but the comment is accurate, and I don't know of any better place to
stick it.
ACK.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org