[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 13/15] blockjob: Add 'id' parameter to 'block-job-re
From: |
Alberto Garcia |
Subject: |
[Qemu-devel] [PATCH 13/15] blockjob: Add 'id' parameter to 'block-job-resume' |
Date: |
Thu, 9 Jun 2016 11:20:18 +0300 |
This patch allows the 'block-job-resume' command to identify the
job by either its ID or its device name. The latter becomes now
optional since the ID alone is enough to identify the job.
The HMP 'block_job_resume' command remains unchanged.
Signed-off-by: Alberto Garcia <address@hidden>
---
blockdev.c | 7 +++++--
hmp.c | 2 +-
qapi/block-core.json | 7 ++++++-
qmp-commands.hx | 2 +-
4 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 591f163..97e5fef 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3801,10 +3801,13 @@ void qmp_block_job_pause(bool has_id, const char *id,
aio_context_release(aio_context);
}
-void qmp_block_job_resume(const char *device, Error **errp)
+void qmp_block_job_resume(bool has_id, const char *id,
+ bool has_device, const char *device, Error **errp)
{
AioContext *aio_context;
- BlockJob *job = find_block_job(NULL, device, &aio_context, errp);
+ BlockJob *job = find_block_job(has_id ? id : NULL,
+ has_device ? device : NULL,
+ &aio_context, errp);
if (!job || !job->user_paused) {
return;
diff --git a/hmp.c b/hmp.c
index 783c3af..dae1735 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1525,7 +1525,7 @@ void hmp_block_job_resume(Monitor *mon, const QDict
*qdict)
Error *error = NULL;
const char *device = qdict_get_str(qdict, "device");
- qmp_block_job_resume(device, &error);
+ qmp_block_job_resume(false, NULL, true, device, &error);
hmp_handle_error(mon, &error);
}
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 0eaf531..0efa73d 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1562,6 +1562,11 @@
#
# This command also clears the error status of the job.
#
+# The job must be identified with the @id or @device parameters, but
+# only one of them must be set.
+#
+# @id: #optional the job identifier. (Since 2.7)
+#
# @device: the device name
#
# Returns: Nothing on success
@@ -1569,7 +1574,7 @@
#
# Since: 1.3
##
-{ 'command': 'block-job-resume', 'data': { 'device': 'str' } }
+{ 'command': 'block-job-resume', 'data': { '*id': 'str', '*device': 'str' } }
##
# @block-job-complete:
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 571feb6..716d493 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -1300,7 +1300,7 @@ EQMP
},
{
.name = "block-job-resume",
- .args_type = "device:B",
+ .args_type = "id:s?,device:B?",
.mhandler.cmd_new = qmp_marshal_block_job_resume,
},
{
--
2.8.1
- [Qemu-devel] [PATCH 07/15] backup: Add 'job-id' parameter to 'blockdev-backup' and 'drive-backup', (continued)
- [Qemu-devel] [PATCH 07/15] backup: Add 'job-id' parameter to 'blockdev-backup' and 'drive-backup', Alberto Garcia, 2016/06/09
- [Qemu-devel] [PATCH 09/15] stream: Add 'job-id' parameter to 'block-commit', Alberto Garcia, 2016/06/09
- [Qemu-devel] [PATCH 06/15] mirror: Add 'job-id' parameter to 'blockdev-mirror' and 'drive-mirror', Alberto Garcia, 2016/06/09
- [Qemu-devel] [PATCH 05/15] blockjob: Add 'job_id' parameter to block_job_create(), Alberto Garcia, 2016/06/09
- [Qemu-devel] [PATCH 13/15] blockjob: Add 'id' parameter to 'block-job-resume',
Alberto Garcia <=
- [Qemu-devel] [PATCH 01/15] stream: Fix prototype of stream_start(), Alberto Garcia, 2016/06/09
- [Qemu-devel] [PATCH 11/15] blockjob: Add 'id' parameter to 'block-job-cancel', Alberto Garcia, 2016/06/09
- [Qemu-devel] [PATCH 02/15] blockjob: Decouple the ID from the device name in the BlockJob struct, Alberto Garcia, 2016/06/09
- [Qemu-devel] [PATCH 04/15] block: Simplify find_block_job() and make it accept a job ID, Alberto Garcia, 2016/06/09