</qemu:capabilities>
</domain>
+Control of QEMU deprecation warnings
+------------------------------------
+
+The following knob controls how QEMU behaves towards deprecated commands and
+arguments used by libvirt:
+
+::
+
+ <domain type='qemu' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
+ <name>testvm</name>
+
+ [...]
+
+ <qemu:deprecation behavior='crash'/>
+
+This setting is meant for developers and CI efforts to make it obvious when
+libvirt relies on fields which are deprecated so that it can be fixes as soon
+as possible.
+
+Possible options are:
+
+``none``
+ (default) qemu is supposed to accept and output deprecated fields and commands
+
+``omit``
+ qemu is instructed to omit deprecated fields on output, behaviour towards
+ fields and commands from libvirtd is not changed
+
+``reject``
+ qemu is instructed to report an error if a deprecated command or field is
+ used by libvirtd
+
+``crash``
+ qemu crashes when an deprecated command or field is used by libvirtd
+
+For both "reject" and "crash" qemu is instructed to omit any deprecated fields
+on output.
+
+The "reject" option is less harsh towards the VMs but some code paths ignore
+errors reported by qemu and thus it may not be obvious that a deprecated
+command/field was used, thus it's suggested to use the "crash" option instead.
+
+In cases when qemu doesn't support configuring the behaviour this setting is
+silently ignored to allow testing older qemu versions without having to
+reconfigure libvirtd.
+
+*DO NOT* use in production.
+
Example domain XML config
-------------------------
<optional>
<ref name="qemucapabilities"/>
</optional>
+ <optional>
+ <ref name="qemudeprecation"/>
+ </optional>
<optional>
<ref name="lxcsharens"/>
</optional>
</element>
</define>
+ <define name="qemudeprecation">
+ <element name="deprecation" ns="http://libvirt.org/schemas/domain/qemu/1.0">
+ <attribute name="behavior">
+ <choice>
+ <value>none</value>
+ <value>omit</value>
+ <value>reject</value>
+ <value>crash</value>
+ </choice>
+ </attribute>
+ </element>
+ </define>
+
<!--
Optional hypervisor extensions in their own namespace:
virStringListFreeCount(def->capsadd, def->ncapsadd);
virStringListFreeCount(def->capsdel, def->ncapsdel);
+ g_free(def->deprecationBehavior);
+
g_free(def);
}
qemuDomainDefNamespaceParseCaps(nsdata, ctxt) < 0)
goto cleanup;
+ nsdata->deprecationBehavior = virXPathString("string(./qemu:deprecation/@behavior)", ctxt);
+
if (nsdata->num_args > 0 || nsdata->num_env > 0 ||
- nsdata->ncapsadd > 0 || nsdata->ncapsdel > 0)
+ nsdata->ncapsadd > 0 || nsdata->ncapsdel > 0 ||
+ nsdata->deprecationBehavior)
*data = g_steal_pointer(&nsdata);
ret = 0;
qemuDomainDefNamespaceFormatXMLCommandline(buf, cmd);
qemuDomainDefNamespaceFormatXMLCaps(buf, cmd);
+ virBufferEscapeString(buf, "<qemu:deprecation behavior='%s'/>\n",
+ cmd->deprecationBehavior);
+
return 0;
}
size_t ncapsdel;
char **capsdel;
+
+ /* We deliberatly keep this as a string so that it's parsed only when
+ * starting the VM to avoid any form of errors in the parser or when
+ * changing qemu versions. The knob is mainly for development/CI purposes */
+ char *deprecationBehavior;
};
<qemu:add capability="blockdev"/>
<qemu:del capability="name"/>
</qemu:capabilities>
+ <qemu:deprecation behavior='crash'/>
</domain>
<qemu:add capability='blockdev'/>
<qemu:del capability='name'/>
</qemu:capabilities>
+ <qemu:deprecation behavior='crash'/>
</domain>