On 04/17/2015 05:02 PM, John Snow wrote:

>>>   { 'type': 'DriveBackup',
>>>     'data': { 'device': 'str', 'target': 'str', '*format': 'str',
>>>               'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
>>> -            '*speed': 'int',
>>> +            '*speed': 'int', '*bitmap': 'str',
>>
>> Looks okay.  Is it an error if bitmap is supplied, but mode is not
>> dirty-bitmap?  Likewise, if mode is dirty-bitmap but bitmap is not
>> supplied?
>>
> 
> Yes:

Then we _could_ do this as a flat union (here, using a shorthand syntax
of anonymous inline types, although qapi does not yet support it):

{ 'type': 'DriveBackupBase',
  'data': { 'device': 'str', 'target': 'str', '*format': 'str',
    'sync': 'MirrorSyncMode', '*mode': 'NewImageMode',
    '*speed': 'int', '*on-source-error': 'BlockdevOnError',
    '*on-target-error': 'BlockdevOnError' } }
{ 'union': 'DriveBackup', 'base': 'DriveBackupBase',
  'discriminator': 'sync',
  'data': { 'top': {}, 'full': {}, 'none': {},
            'dirty-bitmap': { 'bitmap': 'str' } } }

which would enforce that 'bitmap' be present exactly when
'sync':'dirty-bitmap'.  But that's probably overkill; I don't expect you
to do it (especially since qapi shorthand for anonymous inline types is
not there yet).

-- 
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