Hi all, block jobs are currently identified by the name of the block backend of the BDS where the job was started.
The problem with this is that you cannot have block jobs on nodes where there is no such name. This series turns the 'id' field of the BlockJob structure into an actual ID, it guarantees that is unique and always present and allows the user to set it. Berto v4: - Rebase on top of the current master - Patch 4: Disallow null IDs in find_block_job(). - Patches 6-9: Clarify that if @job-id is missing the device name will be used as job ID. - Patch 11: Capitalize the first word in the description of the 'device' parameter. v3: https://lists.gnu.org/archive/html/qemu-devel/2016-07/msg00121.html - Instead of having separate 'id' and 'device' fields, use only the former. If the ID is not specified by the user it defaults to the device name to ensure backward compatibility. - Patch 2: - Don't create a new field, simply update the description and the error messages. - Patch 4: - Now find_block_job() is simply a wrapper around block_job_get() that acquires the AioContext. - Patch 5: - Allow setting the job ID but fall back to the device name if the user doesn't provide one. Fix the tests where the default ID was empty. - Patches 10-14 [v2]: - These are no longer necessary, there's no need to add a new 'id' parameter to the 'block-job-*' QMP commands. - Patch 10 [v3]: - Make img_commit() set a job ID - Patch 11 [v3]: - Update the documentation of the QMP API to explain that the 'device' field is now an actual ID. v2: https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg06397.html - Rebased on top of the current master - Patch 2 - Now that job->id no longer holds the device name, replace "The active block job for device '%s' cannot be completed" with "The active block job '%s' cannot be completed" in mirror_complete() and block_job_complete(). - Patch 4 - Keep using ERROR_CLASS_DEVICE_NOT_ACTIVE in find_block_job() and change error path. [Max] - Patch 6 - Fix merge conflicts after 274fcce. - Patch 9 - Fix subject in commit message [Max] - Patch 15 - Update iotests 109 and 156 [Max] v1: https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg02438.html - Initial release git backport-diff against v3: Key: [----] : patches are identical [####] : number of functional differences between upstream/downstream patch [down] : patch is downstream-only The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively 001/11:[----] [--] 'stream: Fix prototype of stream_start()' 002/11:[----] [--] 'blockjob: Update description of the 'id' field' 003/11:[----] [--] 'blockjob: Add block_job_get()' 004/11:[0009] [FC] 'block: Use block_job_get() in find_block_job()' 005/11:[----] [--] 'blockjob: Add 'job_id' parameter to block_job_create()' 006/11:[0012] [FC] 'mirror: Add 'job-id' parameter to 'blockdev-mirror' and 'drive-mirror'' 007/11:[0012] [FC] 'backup: Add 'job-id' parameter to 'blockdev-backup' and 'drive-backup'' 008/11:[0008] [FC] 'stream: Add 'job-id' parameter to 'block-stream'' 009/11:[0012] [FC] 'commit: Add 'job-id' parameter to 'block-commit'' 010/11:[----] [--] 'qemu-img: Set the ID of the block job in img_commit()' 011/11:[0020] [FC] 'blockjob: Update description of the 'device' field in the QMP API' Alberto Garcia (11): stream: Fix prototype of stream_start() blockjob: Update description of the 'id' field blockjob: Add block_job_get() block: Use block_job_get() in find_block_job() blockjob: Add 'job_id' parameter to block_job_create() mirror: Add 'job-id' parameter to 'blockdev-mirror' and 'drive-mirror' backup: Add 'job-id' parameter to 'blockdev-backup' and 'drive-backup' stream: Add 'job-id' parameter to 'block-stream' commit: Add 'job-id' parameter to 'block-commit' qemu-img: Set the ID of the block job in img_commit() blockjob: Update description of the 'device' field in the QMP API block/backup.c | 9 ++-- block/commit.c | 7 +-- block/mirror.c | 22 +++++---- block/stream.c | 12 ++--- blockdev.c | 113 ++++++++++++++++++++++------------------------ blockjob.c | 39 ++++++++++++++-- docs/qmp-events.txt | 12 +++-- hmp.c | 6 +-- include/block/block_int.h | 47 +++++++++++-------- include/block/blockjob.h | 23 +++++++--- include/qapi/qmp/qerror.h | 3 -- qapi/block-core.json | 72 +++++++++++++++++++++-------- qemu-img.c | 2 +- qmp-commands.hx | 28 ++++++++---- tests/test-blockjob-txn.c | 7 ++- 15 files changed, 249 insertions(+), 153 deletions(-) -- 2.8.1