[libvirt] [PATCHv3.5 05.5/18] blockjob: add new monitor json conversions

Peter Krempa pkrempa at redhat.com
Fri Sep 5 12:00:12 UTC 2014


On 09/05/14 13:36, Eric Blake wrote:
> The previous patch hoisted some bounds checks to the callers;
> but someone that is not aware of the hoisted check could now
> try passing an integer between LLONG_MAX and ULLONG_MAX.  As a
> safety measure, add new json conversion modes that let libvirt
> error out early instead of pass bad numbers to qemu, if the
> caller ever makes a mistake due to later refactoring.
> 
> Convert the various blockjob QMP calls to use the new modes,
> and switch some of them to be optional (QMP has always supported
> an omitted "speed" the same as "speed":0, for everything except
> block-job-set-speed).
> 
> * src/qemu/qemu_monitor_json.c (qemuMonitorJSONMakeCommandRaw):
> Add 'j'/'y' and 'J'/'Y' to error out on negative input.
> (qemuMonitorJSONDriveMirror, qemuMonitorJSONBlockCommit)
> (qemuMonitorJSONBlockJob): Use it.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
> 
> This should address Peter's review concerns on 5/18; I could
> push it either first or second (although I worded the commit
> message to push it second).

Either way I'm fine with it. I just wanted to make sure that we fail
rather than pass garbage to qemu.

> 
>  src/qemu/qemu_monitor_json.c | 34 ++++++++++++++++++++++++++++------
>  1 file changed, 28 insertions(+), 6 deletions(-)
> 

Exactly what I had in mind. ACK.

Peter


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140905/e0c4fa60/attachment-0001.sig>


More information about the libvir-list mailing list