@@ -3805,10 +3805,13 @@ out:
aio_context_release(aio_context);
}
-void qmp_block_job_pause(const char *device, Error **errp)
+void qmp_block_job_pause(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;
@@ -1519,7 +1519,7 @@ void hmp_block_job_pause(Monitor *mon, const QDict *qdict)
Error *error = NULL;
const char *device = qdict_get_str(qdict, "device");
- qmp_block_job_pause(device, &error);
+ qmp_block_job_pause(false, NULL, true, device, &error);
hmp_handle_error(mon, &error);
}
@@ -1537,14 +1537,19 @@
# the operation is actually paused. Cancelling a paused job automatically
# resumes it.
#
-# @device: the device name
+# 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: #optional the device name
#
# Returns: Nothing on success
# If no background operation is active on this device, DeviceNotActive
#
# Since: 1.3
##
-{ 'command': 'block-job-pause', 'data': { 'device': 'str' } }
+{ 'command': 'block-job-pause', 'data': { '*id': 'str', '*device': 'str' } }
##
# @block-job-resume:
@@ -1322,7 +1322,7 @@ EQMP
},
{
.name = "block-job-pause",
- .args_type = "device:B",
+ .args_type = "id:s?,device:B?",
.mhandler.cmd_new = qmp_marshal_block_job_pause,
},
{