qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Fabiano Rosas <farosas@suse.de>,
	qemu-devel@nongnu.org, prerna.saxena@nutanix.com,
	dgilbert@redhat.com, pbonzini@redhat.com, eblake@redhat.com,
	manish.mishra@nutanix.com, aravind.retnakaran@nutanix.com,
	Het Gala <het.gala@nutanix.com>,
	Juan Quintela <quintela@redhat.com>, Peter Xu <peterx@redhat.com>,
	Leonardo Bras <leobras@redhat.com>
Subject: Re: [PATCH v14 02/14] fixup! migration: New QAPI type 'MigrateAddress'
Date: Fri, 20 Oct 2023 14:31:13 +0100	[thread overview]
Message-ID: <ZTKBIUEayhIOshcD@redhat.com> (raw)
In-Reply-To: <87o7gt1ncz.fsf@pond.sub.org>

On Fri, Oct 20, 2023 at 02:37:16PM +0200, Markus Armbruster wrote:
> Fabiano Rosas <farosas@suse.de> writes:
> 
> > Markus Armbruster <armbru@redhat.com> writes:
> >
> >> Fabiano Rosas <farosas@suse.de> writes:
> >>
> >>> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> >
> > Side question: are we using valid JSON at all? I threw this in a random
> > online linter and it complains about the single quotes. We could have a
> > proper tool doing the validation in CI.
> 
> You've come a sad, sad place.
> 
> docs/devel/qapi-code-gen.rst:
> 
>     Schema syntax
>     -------------
> 
>     Syntax is loosely based on `JSON <http://www.ietf.org/rfc/rfc8259.txt>`_.
>     Differences:
> 
>     * Comments: start with a hash character (``#``) that is not part of a
>       string, and extend to the end of the line.
> 
>     * Strings are enclosed in ``'single quotes'``, not ``"double quotes"``.
> 
>     * Strings are restricted to printable ASCII, and escape sequences to
>       just ``\\``.
> 
>     * Numbers and ``null`` are not supported.
> 
> If your reaction to item 2 is "this is stupid", you'd be exactly right.
> 
> Here's the conclusion of a discussion on possible improvements we had in
> 2020:
> https://lore.kernel.org/qemu-devel/877dt5ofoi.fsf@dusky.pond.sub.org/

Looking at those options again I so strongly want to be able to
say "none of the above".

We have a need to describe data structures, and generate code for
serializing/deserializing them on the wire. We created a language
for this and wrote our own C code generator, our own docs generator,
own our json parser & formatter, and now are also writing our own
Go code generator (Python, Rust too ?).

IMHO this is way too much NiH for my likely, and creates a maint
burden for ourselves that we could do without.

<open-can-of-worms>
At the point in time we invented QAPI this was perhaps justifiable,
though even back then I thought we should have done a binary format
and used XDR to describe it, as a standard pre-existing language and
toolset.

Today I wouldn't suggest XDR, but would be inclined to suggest
Protobuf. This already has code & docs generators for every
programming language we would ever need.

Protobuf has a defined serialization format too though which is
binary based IIUC, so distinct from our JSON wire format.

The interesting question though is whether it would be feasible to
transition to this today, despite our historical baggage ? With
recent interest in accessing QAPI for many more languages, it
is timely to consider if we can adopt a standardized toolset to
reduce this burden of talking to QEMU from other languages.

A transition would need several big ticket items

 * A QAPI visitor impl that can spit out the protobuf document.
   ie to translate all our existing QAPI formats into protobuf,
   as doing this manually would be madness. This is probably
   the easy bit.

 * A custom protobuf visitor impl that can spit out C code
   that has the same API as our QAPI C generator. ie so we can
   avoid a big bang to convert all of QEMU internals. I suspect
   this is quite alot of work.

 * A custom protobuf serializer compatible with our current
   JSON format. ie so that QEMU can continue to expose the
   current QMP protocol to apps for legacy compat for some
   period of time, while also exposing a new native binary
   protobuf protocol for future usage. Also probably quite
   alot of work.

That's all certainly quite alot of work and probably things I have
forgotten. Above all it does assume it is possible to define a
loss-less mapping from QAPI -> Protobuf language. I've not proved
this is possible, but my inclination is that it probably should be,
and if not, we could likely enable it by strategically deprecated
and then deleting troublesome bits prior to a conversion.
</open-can-of-worms>

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2023-10-20 13:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 19:23 [PATCH v14 00/14] migration: Modify 'migrate' and 'migrate-incoming' QAPI commands for migration Fabiano Rosas
2023-10-19 19:23 ` [PATCH v14 01/14] migration: New QAPI type 'MigrateAddress' Fabiano Rosas
2023-10-19 19:23 ` [PATCH v14 02/14] fixup! " Fabiano Rosas
2023-10-20  5:06   ` Markus Armbruster
2023-10-20 12:07     ` Fabiano Rosas
2023-10-20 12:37       ` Markus Armbruster
2023-10-20 13:31         ` Daniel P. Berrangé [this message]
2023-10-23  9:01           ` Should we replace QAPI? (was: [PATCH v14 02/14] fixup! migration: New QAPI type 'MigrateAddress') Markus Armbruster
2023-10-23 12:20             ` Daniel P. Berrangé
2023-10-23 11:56   ` [PATCH v14 02/14] fixup! migration: New QAPI type 'MigrateAddress' Daniel P. Berrangé
2023-10-19 19:23 ` [PATCH v14 03/14] migration: convert migration 'uri' into 'MigrateAddress' Fabiano Rosas
2023-10-19 19:23 ` [PATCH v14 04/14] fixup! " Fabiano Rosas
2023-10-23 11:55   ` Daniel P. Berrangé
2023-10-31 15:10     ` Juan Quintela
2023-10-19 19:23 ` [PATCH v14 05/14] migration: convert socket backend to accept MigrateAddress Fabiano Rosas
2023-10-19 19:23 ` [PATCH v14 06/14] migration: convert rdma " Fabiano Rosas
2023-10-19 19:23 ` [PATCH v14 07/14] migration: convert exec " Fabiano Rosas
2023-10-19 19:23 ` [PATCH v14 08/14] migration: Convert the file backend the new QAPI syntax Fabiano Rosas
2023-10-19 19:23 ` [PATCH v14 09/14] migration: New migrate and migrate-incoming argument 'channels' Fabiano Rosas
2023-10-19 19:23 ` [PATCH v14 10/14] fixup! " Fabiano Rosas
2023-10-23 11:54   ` Daniel P. Berrangé
2023-10-19 19:23 ` [PATCH v14 11/14] migration: modify migration_channels_and_uri_compatible() for new QAPI syntax Fabiano Rosas
2023-10-19 19:23 ` [PATCH v14 12/14] migration: Implement MigrateChannelList to qmp migration flow Fabiano Rosas
2023-10-19 19:23 ` [PATCH v14 13/14] migration: Implement MigrateChannelList to hmp " Fabiano Rosas
2023-10-19 19:23 ` [PATCH v14 14/14] migration: modify test_multifd_tcp_none() to use new QAPI syntax Fabiano Rosas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZTKBIUEayhIOshcD@redhat.com \
    --to=berrange@redhat.com \
    --cc=aravind.retnakaran@nutanix.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=farosas@suse.de \
    --cc=het.gala@nutanix.com \
    --cc=leobras@redhat.com \
    --cc=manish.mishra@nutanix.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=prerna.saxena@nutanix.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).