Eric Blake raised concerns about the inability to start block jobs with a speed limit. Current the user needs to follow up the block-stream command with block-job-set-speed. There is a window of time while the new block job is running but block-job-set-speed has not been processed yet.
This series adds an optional 'speed' parameter to block-stream so streaming can be started with a speed limit that takes effect immediately. For consistency it also renames the block-job-set-speed parameter from 'value' to 'speed'. This is externally visible, but this API has not been in a QEMU release yet so we can still do this. I considered several other approaches, including adding a default_block_job_speed field to BlockDriverState but ultimately the cleanest solution is to pass in a speed parameter on job creation. This way we do not change semantics of existing commands, we only add an optional parameter. We also do not need to add state to BlockDriverState, which is already huge and messy. v3: * Fix 'an' -> 'and' typo in Patch 1 description [Eric] * Document block-stream @speed parameter fully [Kevin] * Rephrase error argument doc comment [Luiz] * Fix block_stream [speed [base]] options doc [Eric] * Fix BlockJobSpeedInvalid -> InvalidParameter [Luiz] * Add test for block job speed setting success case [Eric] * Drop unrelated qemu-iotests 030 fix from this series Stefan Hajnoczi (5): block: use Error mechanism instead of -errno for block_job_create() block: use Error mechanism instead of -errno for block_job_set_speed() block: change block-job-set-speed argument from 'value' to 'speed' block: add 'speed' optional parameter to block-stream qemu-iotests: add block-stream speed value test case block.c | 35 +++++++++++++---- block/stream.c | 22 +++++------ block_int.h | 19 ++++++--- blockdev.c | 26 +++++-------- hmp-commands.hx | 8 ++-- hmp.c | 4 +- qapi-schema.json | 12 ++++-- qmp-commands.hx | 4 +- tests/qemu-iotests/030 | 91 ++++++++++++++++++++++++++++++++++---------- tests/qemu-iotests/030.out | 4 +- 10 files changed, 151 insertions(+), 74 deletions(-) -- 1.7.10