On 05/12/2014 10:12 PM, Amit Shah wrote:
> Hi,
> 
> On (Mon) 12 May 2014 [06:51:54], Eric Blake wrote:
>> On 05/12/2014 05:16 AM, Amit Shah wrote:
>>> This commit adds a new command, '-dump-vmstate', that takes a filename
>>> as a parameter.  When executed, QEMU will dump the vmstate information
>>> for the machine type it's invoked with to the file, and quit.
>>>
>>> The JSON-format output can then be used to compare the vmstate info for
>>> different QEMU versions, specifically to test whether live migration
>>> would break due to changes in the vmstate data.
>>
>> Are we going to document that JSON format anywhere?
> 
> I suppose we should, I thought I should wait for comments here on any
> extra fields that people want.
> 
> I suppose documenting would just be coming up with a schema, though? ...
> 
>>  Is it worth making
>> it part of qapi-schema.json,
> 
> but documenting the entire schema is difficult, as each device will
> have its own schema text (due to the differing fields).  At least
> that's how I understand it; please correct me if I'm wrong.

If field names form JSON keys, then yes, documenting each device will be
its own schema.  But if you write things generic enough, you can have a
single schema that covers all devices, by ensuring that device-specific
field names are supplied only as values, not keys.

That is,
 'device': { 'name': 'foo',
   'fields': { 'field1': 'int32', 'field2': 'int64' }
 }

requires a schema for each device, while
 'device': { 'name': 'foo',
   'fields': [
     { 'name': 'field1', 'type': 'int32' },
     { 'name': 'field2', 'type': 'int64' }
   ]
 }

is generic.  It is more verbose and requires more structure, but by
isolating device details into values rather than keys, you get rid of
the need for per-device schemas.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to