mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: Add per-VM control of deprecation behavior
Similar to the qemu.conf knob 'deprecation_behavior' add a per-VM knob in the QEMU namespace: <qemu:deprecation behavior='...'/> Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
ceb00a5ade
commit
a6444c8019
@ -523,6 +523,54 @@ Example:
|
|||||||
</qemu:capabilities>
|
</qemu:capabilities>
|
||||||
</domain>
|
</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
|
Example domain XML config
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
@ -77,6 +77,9 @@
|
|||||||
<optional>
|
<optional>
|
||||||
<ref name="qemucapabilities"/>
|
<ref name="qemucapabilities"/>
|
||||||
</optional>
|
</optional>
|
||||||
|
<optional>
|
||||||
|
<ref name="qemudeprecation"/>
|
||||||
|
</optional>
|
||||||
<optional>
|
<optional>
|
||||||
<ref name="lxcsharens"/>
|
<ref name="lxcsharens"/>
|
||||||
</optional>
|
</optional>
|
||||||
@ -7270,6 +7273,19 @@
|
|||||||
</element>
|
</element>
|
||||||
</define>
|
</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:
|
Optional hypervisor extensions in their own namespace:
|
||||||
|
@ -3316,6 +3316,8 @@ qemuDomainXmlNsDefFree(qemuDomainXmlNsDefPtr def)
|
|||||||
virStringListFreeCount(def->capsadd, def->ncapsadd);
|
virStringListFreeCount(def->capsadd, def->ncapsadd);
|
||||||
virStringListFreeCount(def->capsdel, def->ncapsdel);
|
virStringListFreeCount(def->capsdel, def->ncapsdel);
|
||||||
|
|
||||||
|
g_free(def->deprecationBehavior);
|
||||||
|
|
||||||
g_free(def);
|
g_free(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3468,8 +3470,11 @@ qemuDomainDefNamespaceParse(xmlXPathContextPtr ctxt,
|
|||||||
qemuDomainDefNamespaceParseCaps(nsdata, ctxt) < 0)
|
qemuDomainDefNamespaceParseCaps(nsdata, ctxt) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
nsdata->deprecationBehavior = virXPathString("string(./qemu:deprecation/@behavior)", ctxt);
|
||||||
|
|
||||||
if (nsdata->num_args > 0 || nsdata->num_env > 0 ||
|
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);
|
*data = g_steal_pointer(&nsdata);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -3539,6 +3544,9 @@ qemuDomainDefNamespaceFormatXML(virBufferPtr buf,
|
|||||||
qemuDomainDefNamespaceFormatXMLCommandline(buf, cmd);
|
qemuDomainDefNamespaceFormatXMLCommandline(buf, cmd);
|
||||||
qemuDomainDefNamespaceFormatXMLCaps(buf, cmd);
|
qemuDomainDefNamespaceFormatXMLCaps(buf, cmd);
|
||||||
|
|
||||||
|
virBufferEscapeString(buf, "<qemu:deprecation behavior='%s'/>\n",
|
||||||
|
cmd->deprecationBehavior);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,6 +485,11 @@ struct _qemuDomainXmlNsDef {
|
|||||||
|
|
||||||
size_t ncapsdel;
|
size_t ncapsdel;
|
||||||
char **capsdel;
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,4 +32,5 @@
|
|||||||
<qemu:add capability="blockdev"/>
|
<qemu:add capability="blockdev"/>
|
||||||
<qemu:del capability="name"/>
|
<qemu:del capability="name"/>
|
||||||
</qemu:capabilities>
|
</qemu:capabilities>
|
||||||
|
<qemu:deprecation behavior='crash'/>
|
||||||
</domain>
|
</domain>
|
||||||
|
@ -48,4 +48,5 @@
|
|||||||
<qemu:add capability='blockdev'/>
|
<qemu:add capability='blockdev'/>
|
||||||
<qemu:del capability='name'/>
|
<qemu:del capability='name'/>
|
||||||
</qemu:capabilities>
|
</qemu:capabilities>
|
||||||
|
<qemu:deprecation behavior='crash'/>
|
||||||
</domain>
|
</domain>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user