On 03/08/18 11:17, Daniel P. Berrangé wrote:
On Thu, Mar 08, 2018 at 08:52:45AM +0100, Gerd Hoffmann wrote:
> Hi,
>
>>> [*] Open question: Who, between QEMU and libvirt, should define the said
>>> firmware metadata format and file?
>>
>> IMHO QEMU should be defining the format, because the file will contain
>> info about certain QEMU features associated with the firmware (eg smm).
>> Also there are potentially other non-libvirt mgmt apps that spawn QEMU
>> which would like this info (eg libguestfs), so having libvirt define the
>> format is inappropriate.
>>
>> I'd suggest we just need something in docs/specs/firmware-metadata.rst
>> for QEMU source tree.
>>
>> Potentially QEMU could even use the metadata files itself for finding
>> the default firmeware images, instead of compiling this info into its
>> binaries. I wouldn't suggest we need todo that right away, but bear it
>> in mind as a potential use case.
>
> With qemu using this itself in mind it probably makes sense to specify
> this as qapi schema. That'll simplify parsing and using these files in
> qemu, and possibly simplifies things on the libvirt side too.
I was thinking of an 'ini' style format, similar to that used by systemd
unit files, but a JSON format file is a nicer fit with QEMU & Libvirt if
we describe it with qapi.
I've created an RFC-level "qapi/firmware.json" schema file, based on
this discussion. It "builds", and the generated documentation looks
acceptable, superficially speaking.
Before I post "qapi/firmware.json" for getting comments, I'd like to
write JSON text that (a) describes firmware that I use, and (b) conforms
to the schema. IOW, I'd like to validate whether the schema is good
enough for describing at least such firmware that I know.
Is there a tool that generates example JSON objects from a given schema?
I vaguely recall there used to be one. Otherwise, writing the examples
manually looks arduous (and I wouldn't know how to verify them against
the schema).
Thanks!
Laszlo