On Fri, Jul 31, 2020 at 06:35:23PM +0200, Paolo Bonzini wrote: > On 31/07/20 17:26, John Snow wrote: > > I saw the critique that we still use JSON-ish for the runtime QMP > > protocol, and moving the QAPI IDL to a standard wouldn't remove all > > instances of a custom format from our tree. > > Sorry, but "still using JSON" is not a critique that makes any sense. > > 99% of the websites you use daily use JSON as their RPC > frontend-to-backend language; OpenAPI is essentially JSON over HTTP. > There must be something good in JSON.
I think it is more about the way we're using JSON to define QMP. We take a raw socket (or really arbitrary reliable stream no matter what its transport), and are defining the full RPC protocol. We define the initial QMP handshake, the separation of commands/replies/events and of course the data format for the content sent. We've invented the whole stack above the raw sockets layer. In the case of typical REST APIs, HTTP provides the core protocol with handshake, and separation of commands/replies. The application is merely declaring JSON to be the data format for the messages. So in the case of REST APIS with JSON, you can use any standard HTTP / REST client library, for the protocol part and any standard JSON library for the data (de)serialization. Talking to QEMU you get to build your own client from first principals. QMP isn't especially complicated, so this isn't a massive burden, but it doesn't exactly give a good first impression either. It also means QMP isn't easily extensible. eg if we used HTTP as our base, then we'd get remote TLS support for free from whatever library we used. We could do TLS with QMP, but again we get to build the pieces for this on both client/server side. Using a standard like HTTP would open door to other interesting ideas, like putting a HTTP proxy on a host, so you can have 1 HTTP server fronting all 1000 VMs on the host, meaning only need a single port instead of 1000 ports in the firewall. Again you can build such an architecture on top of QMP but its all wheel reinvention. 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 :|