@@ -3842,10 +3842,13 @@ void qmp_block_job_resume(bool has_id, const char *id,
aio_context_release(aio_context);
}
-void qmp_block_job_complete(const char *device, Error **errp)
+void qmp_block_job_complete(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) {
return;
@@ -1539,7 +1539,7 @@ void hmp_block_job_complete(Monitor *mon, const QDict *qdict)
Error *error = NULL;
const char *device = qdict_get_str(qdict, "device");
- qmp_block_job_complete(device, &error);
+ qmp_block_job_complete(false, NULL, true, device, &error);
hmp_handle_error(mon, &error);
}
@@ -1593,6 +1593,11 @@
#
# A cancelled or paused job cannot be completed.
#
+# 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
@@ -1600,7 +1605,7 @@
#
# Since: 1.3
##
-{ 'command': 'block-job-complete', 'data': { 'device': 'str' } }
+{ 'command': 'block-job-complete', 'data': { '*id': 'str', '*device': 'str' } }
##
# @BlockdevDiscardOptions
@@ -1332,7 +1332,7 @@ EQMP
},
{
.name = "block-job-complete",
- .args_type = "device:B",
+ .args_type = "id:s?,device:B?",
.mhandler.cmd_new = qmp_marshal_block_job_complete,
},
{