mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 15:15:46 +00:00
blockjob: introduce block-job-change QMP command
which will allow changing job-type-specific options after job creation. In the JobVerbTable, the same allow bits as for set-speed are used, because set-speed can be considered an existing change command. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Message-ID: <20231031135431.393137-2-f.ebner@proxmox.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
20
blockjob.c
20
blockjob.c
@ -330,6 +330,26 @@ static bool block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||
return block_job_set_speed_locked(job, speed, errp);
|
||||
}
|
||||
|
||||
void block_job_change_locked(BlockJob *job, BlockJobChangeOptions *opts,
|
||||
Error **errp)
|
||||
{
|
||||
const BlockJobDriver *drv = block_job_driver(job);
|
||||
|
||||
GLOBAL_STATE_CODE();
|
||||
|
||||
if (job_apply_verb_locked(&job->job, JOB_VERB_CHANGE, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (drv->change) {
|
||||
job_unlock();
|
||||
drv->change(job, opts, errp);
|
||||
job_lock();
|
||||
} else {
|
||||
error_setg(errp, "Job type does not support change");
|
||||
}
|
||||
}
|
||||
|
||||
void block_job_ratelimit_processed_bytes(BlockJob *job, uint64_t n)
|
||||
{
|
||||
IO_CODE();
|
||||
|
Reference in New Issue
Block a user