[libvirt] [Qemu-devel] [PATCH 2/2] qapi: deprecate implicit filters

Markus Armbruster armbru at redhat.com
Fri Nov 22 08:41:21 UTC 2019

Reviving this old thread, because I'd like to connect it to more recent

Christophe de Dinechin <dinechin at redhat.com> writes:

> Markus Armbruster writes:
>> Peter Krempa <pkrempa at redhat.com> writes:
> [...]
>>> From my experience users report non-fatal messages mostly only if it is
>>> spamming the system log. One of instances are very unlikely to be
>>> noticed.
>>> In my experience it's better to notify us in libvirt of such change and
>>> we will try our best to fix it.
>> How to best alert the layers above QEMU was one of the topic of the KVM
>> Forum 2018 BoF on deprecating stuff.  Minutes:
>>     Message-ID: <87mur0ls8o.fsf at dusky.pond.sub.org>
>>     https://lists.nongnu.org/archive/html/qemu-devel/2018-10/msg05828.html
>> Relevant part:
>> * We need to communicate "you're using something that is deprecated".
>>   How?  Right now, we print a deprecation message.  Okay when humans use
>>   QEMU directly in a shell.  However, when QEMU sits at the bottom of a
>>   software stack, the message will likely end up in a log file that is
>>   effectively write-only.
>>   - The one way to get people read log files is crashing their
>>     application.  A command line option --future could make QEMU crash
>>     right after printing a deprecation message.  This could help with
>>     finding use of deprecated features in a testing environment.
>>   - A less destructive way to grab people's attention is to make things
>>     run really, really slow: have QEMU go to sleep for a while after
>>     printing a deprecation message.
>>   - We can also pass the buck to the next layer up: emit a QMP event.
>>     Sadly, by the time the next layer connects to QMP, plenty of stuff
>>     already happened.  We'd have to buffer deprecation events somehow.
>>     What would libvirt do with such an event?  Log it, taint the domain,
>>     emit a (libvirt) event to pass it on to the next layer up.
>>   - A completely different idea is to have a configuratin linter.  To
>>     support doing this at the libvirt level, QEMU could expose "is
>>     deprecated" in interface introspection.  Feels feasible for QMP,
>>     where we already have sufficiently expressive introspection.  For
>>     CLI, we'd first have to provide that (but we want that anyway).
>>   - We might also want to dispay deprecation messages in QEMU's GUI
>>     somehow, or on serial consoles.
> Sorry for catching up late, this mail thread happened during my PTO.
> I remember bringing up at the time [1] that the correct solution needs
> to take into account usage models that vary from
> - a workstation case, where displaying an error box is easy and
>   convenient,
> - to local headless VMs where system-level notification would do the job
>   better, allowing us to leverage things like system-wide email notifications
> - to large-scale collections of VMs managed by some layered product,
>   where the correct reporting would be through something like Insights,
>   i.e. you don't scan individual logs, you want something like "913 VMs
>   are using deprecated X"
> To me, that implies that we need to have a clear division of roles, with
> a standard way to
> a) produce the errors,
> b) propagate them,
> c) consume them (at least up to libvirt)
> Notice that this work has already been done for "real" errors,
> i.e. there is a real QAPI notion of "errors". AFAICT, warn_report does
> not connect to it, though, it goes through error_vprintf which is really
> just basic logging.
> So would it make sense to:
> 1. Add a deprecation_report() alongside warn_report()?

"Grepability" alone would make that worthwhile, I think.

> 2. Connect warn_report() and all the error_vprintf output to QAPI,
>    e.g. using John's suggestion of adding the messages using some
>    "warning" or "deprecated" tag?

This is the difficult part.  See my "Exposing feature deprecation to
machine clients (was: [Qemu-devel] [PATCH 2/2] qapi: deprecate implicit
filters)" in this thread.  Quote:

    Propagating errors is painful.  It has caused massive churn all over the

    I don't think we can hitch deprecation info to the existing error
    propagation, since we need to take the success path back to the QMP
    core, not an error path.

    Propagating a second object for warnings... thanks, but no thanks.

    The QMP core could provide a function for recording deprecation info for
    the currently executing QMP command.  This is how we used to record
    errors in QMP commands, until Anthony rammed through what we have now.
    The commit messages (e.g. d5ec4f27c38) provide no justification.  I
    dimly recall adamant (oral?) claims that recording errors in the Monitor
    object cannot work for us.

    I smell a swamp.

    Can we avoid plumbing deprecation info from command code to QMP core?
    Only if the QMP core itself can recognize deprecated interfaces.  I
    believe it can for the cases we can expose in introspecion.  Let me

    Kevin recently added "features" to the QAPI schema language.  The
    implementation is incomplete, but that's detail.  The idea is to tack a
    "deprecated" feature to deprecated stuff in the QAPI schema.

    Commands and arguments need to support features for that.
    Implementation should be relatively straightforward.

    Deprecating an argument's optionalness may require a
    "optional-deprecated" feature.  I've seen more elegant designs, but I've
    also seen plenty of uglier ones.

    Note that features are tied to schema syntax.  To express semantically
    conditional deprecation like "if you specify argument FOO, then not
    specifying argument BAR is deprecated", we'd have to add a language for
    these conditions.  Uh, not now, maybe never.

    The primary use of having deprecation defined in the QAPI schema is
    introspection.  The BoF minutes mention this, too.

    A secondary use could be detecting use of deprecated features right in
    the QMP core.  No need for ad hoc code in commands, no need for plumbing
    information from there to the QMP core.

    I'd like to pursue this idea, then see how well it suits our deprecation

I've since explored this idea in

    [RFC PATCH 00/19] Configurable policy for handling deprecated interfaces
    Message-Id: <20191024123458.13505-1-armbru at redhat.com>

> 3. Teach libvirt how to consume that new tag and pass it along?

Message-ID: <20191024140146.GC8381 at redhat.com>

Quoting Dan's conclusion:

    In summary, it is probably reasonable to include this info in the QMP
    command reply, but don't expect much to be done with it beyond possibly
    writing it to a log file.

> [1] https://lists.nongnu.org/archive/html/qemu-devel/2018-10/msg06131.html
> --
> Cheers,
> Christophe de Dinechin (IRC c3d)

More information about the libvir-list mailing list