[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 07/15] qapi: add job-change
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[RFC 07/15] qapi: add job-change |
Date: |
Wed, 13 Mar 2024 18:08:59 +0300 |
Add a new-style command job-change, doing same thing as
block-job-change. The aim is finally deprecate block-job-* APIs and
move to job-* APIs.
We add a new command to qapi/block-core.json, not to
qapi/job.json to avoid resolving json file including loops for now.
This all would be a lot simple to refactor when we finally drop
deprecated block-job-* APIs.
@type argument of the new command immediately becomes deprecated.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
docs/about/deprecated.rst | 4 ++--
job-qmp.c | 14 ++++++++++++++
qapi/block-core.json | 10 ++++++++++
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 64981e5e4a..5ff98ef95f 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -143,8 +143,8 @@ all arguments passed to ``device_add`` are consistent with
the documented
property types.
-``block-job-change`` argument ``type`` (since 9.1)
-''''''''''''''''''''''''''''''''''''''''''''''''''
+``block-job-change`` and ``job-change`` argument ``type`` (since 9.1)
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
QEMU can get job type from the job itself (by @id), @type field is redundant.
diff --git a/job-qmp.c b/job-qmp.c
index abe9b59487..011a8736ea 100644
--- a/job-qmp.c
+++ b/job-qmp.c
@@ -141,6 +141,20 @@ void qmp_job_dismiss(const char *id, Error **errp)
job_dismiss_locked(&job, errp);
}
+void qmp_job_change(JobChangeOptions *opts, Error **errp)
+{
+ Job *job;
+
+ JOB_LOCK_GUARD();
+ job = find_job_locked(opts->id, errp);
+
+ if (!job) {
+ return;
+ }
+
+ job_change_locked(job, opts, errp);
+}
+
/* Called with job_mutex held. */
static JobInfo *job_query_single_locked(Job *job, Error **errp)
{
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 3d890dfcd0..f5cefa441b 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -3105,6 +3105,16 @@
{ 'command': 'block-job-change',
'data': 'JobChangeOptions', 'boxed': true }
+##
+# @job-change:
+#
+# Change the block job's options.
+#
+# Since: 9.1
+##
+{ 'command': 'job-change',
+ 'data': 'JobChangeOptions', 'boxed': true }
+
##
# @BlockdevDiscardOptions:
#
--
2.34.1
- [RFC 00/15] block job API, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 01/15] scripts/qapi: support type-based unions, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 03/15] blockjob: block_job_change_locked(): check job type, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 07/15] qapi: add job-change,
Vladimir Sementsov-Ogievskiy <=
- [RFC 12/15] qapi: rename BlockDeviceIoStatus to IoStatus, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 13/15] qapi: move IoStatus to common.json, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 08/15] qapi: job-change: support speed parameter, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 09/15] qapi: job-complete: introduce no-block-replace option for mirror, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 02/15] qapi: rename BlockJobChangeOptions to JobChangeOptions, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 06/15] blockjob: move change action implementation to job from block-job, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 10/15] qapi: query-jobs: add information specific for job type, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 14/15] qapi: query-job: add block-job specific information, Vladimir Sementsov-Ogievskiy, 2024/03/13
- [RFC 04/15] qapi: block-job-change: make copy-mode parameter optional, Vladimir Sementsov-Ogievskiy, 2024/03/13