[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Esoteric QMP specification questions of dubious importance
From: |
Eric Blake |
Subject: |
Re: Esoteric QMP specification questions of dubious importance |
Date: |
Tue, 13 Jul 2021 13:06:02 -0500 |
User-agent: |
NeoMutt/20210205-569-37ed14 |
On Thu, Jul 08, 2021 at 01:10:46PM +0200, Markus Armbruster wrote:
> John Snow <jsnow@redhat.com> writes:
>
> > I'm writing a "fake" QMP server for the purposes of creating unit tests for
> > the python QMP library. In doing so, I am left with some esoteric questions:
> >
> >
> > (1) qemu-spec.txt, section 2.4.2, "error":
> >
> > The format of an "error response" is:
> >
> >> { "error": { "class": json-string, "desc": json-string }, "id": json-value
> >> }
> >
> > For the purposes of naming internal types in the QMP library, does the
> > "error" object value have a canonical type name? It's not defined in QAPI
> > that I can see.
>
> No, it isn't. It's built manually from an Error object in
> qmp_error_response():
>
> rsp = qdict_from_jsonf_nofail("{ 'error': { 'class': %s, 'desc': %s } }",
> QapiErrorClass_str(error_get_class(err)),
> error_get_pretty(err));
If we _need_ it to appear in the QAPI, it should certainly be
possible. So far, no one has presented a need, but your unit tester
may be the reason to codify it.
>
> > Weird questions, I know.
>
> There are no weird questions, only weird people ;-P
Hey, I resemble that remark ;)
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org