From 8ccb9569a976056c9594bb720ba33d84827648d9 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Wed, 16 Sep 2015 13:34:54 +0200 Subject: blockjob: Store device name at job creation Some block jobs change the block device graph on completion. This means that the device that owns the job and originally was addressed with its device name may no longer be what the corresponding BlockBackend points to. Previously, the effects of bdrv_swap() ensured that the job was (at least partially) transferred to the target image. Events that contain the device name could still use bdrv_get_device_name(job->bs) and get the same result. After removing bdrv_swap(), this won't work any more. Instead, save the device name at job creation and use that copy for QMP events and anything else identifying the job. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz Reviewed-by: Alberto Garcia Reviewed-by: Fam Zheng Reviewed-by: Stefan Hajnoczi --- include/block/blockjob.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/block') diff --git a/include/block/blockjob.h b/include/block/blockjob.h index dd9d5e6..289b13f 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -65,6 +65,14 @@ struct BlockJob { BlockDriverState *bs; /** + * The ID of the block job. Currently the BlockBackend name of the BDS + * owning the job at the time when the job is started. + * + * TODO Decouple block job IDs from BlockBackend names + */ + char *id; + + /** * The coroutine that executes the job. If not NULL, it is * reentered when busy is false and the job is cancelled. */ -- cgit v1.1