From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:32853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvqYt-0007dw-I3 for qemu-devel@nongnu.org; Tue, 23 Aug 2011 08:58:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QvqYs-00023z-3A for qemu-devel@nongnu.org; Tue, 23 Aug 2011 08:58:35 -0400 Received: from mtagate1.uk.ibm.com ([194.196.100.161]:38028) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QvqYr-00023b-R4 for qemu-devel@nongnu.org; Tue, 23 Aug 2011 08:58:34 -0400 Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate1.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p7NCwWCC002904 for ; Tue, 23 Aug 2011 12:58:32 GMT Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p7NCwVkj2453510 for ; Tue, 23 Aug 2011 13:58:32 +0100 Received: from d06av08.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p7NCwUnD021099 for ; Tue, 23 Aug 2011 13:58:30 +0100 From: Stefan Hajnoczi Date: Tue, 23 Aug 2011 13:58:24 +0100 Message-Id: <1314104305-20523-4-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1314104305-20523-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1314104305-20523-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 3/4] qmp: add block_job_cancel command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Stefan Hajnoczi , Adam Litke This patch introduces the block_job_cancel HMP/QMP command. It is currently unimplemented and returns the 'DeviceNotActive' error. block_job_cancel ---------------- Stop an active block streaming operation. This command returns once the active block streaming operation has been stopped. It is an error to call this command if no operation is in progress. The image file retains its backing file unless the streaming operation happens to complete just as it is being cancelled. A new block streaming operation can be started at a later time to finish copying all data from the backing file. Arguments: - device: device name (json-string) Errors: DeviceNotActive: streaming is not active on this device DeviceInUse: cancellation already in progress Examples: -> { "execute": "block_job_cancel", "arguments": { "device": "virtio0" } } <- { "return": {} } Signed-off-by: Stefan Hajnoczi --- blockdev.c | 8 ++++++++ blockdev.h | 1 + hmp-commands.hx | 15 +++++++++++++++ qmp-commands.hx | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 0 deletions(-) diff --git a/blockdev.c b/blockdev.c index ee40263..036b7eb 100644 --- a/blockdev.c +++ b/blockdev.c @@ -827,3 +827,11 @@ int do_block_job_set_speed(Monitor *mon, const QDict *params, qerror_report(QERR_NOT_SUPPORTED); return -1; } + +int do_block_job_cancel(Monitor *mon, const QDict *params, QObject **ret_data) +{ + const char *device = qdict_get_str(params, "device"); + + qerror_report(QERR_DEVICE_NOT_ACTIVE, device); + return -1; +} diff --git a/blockdev.h b/blockdev.h index 6b48405..a132d36 100644 --- a/blockdev.h +++ b/blockdev.h @@ -68,5 +68,6 @@ int do_block_resize(Monitor *mon, const QDict *qdict, QObject **ret_data); int do_block_stream(Monitor *mon, const QDict *qdict, QObject **ret_data); int do_block_job_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data); +int do_block_job_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data); #endif diff --git a/hmp-commands.hx b/hmp-commands.hx index a5fb4d5..ff1a54b 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -101,6 +101,21 @@ Set maximum speed for a background block operation. ETEXI { + .name = "block_job_cancel", + .args_type = "device:B", + .params = "device", + .help = "stop an active block streaming operation", + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_block_job_cancel, + }, + +STEXI +@item block_job_cancel +@findex block_job_cancel +Stop an active block streaming operation. +ETEXI + + { .name = "eject", .args_type = "force:-f,device:B", .params = "[-f] device", diff --git a/qmp-commands.hx b/qmp-commands.hx index eface05..de442f7 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -794,6 +794,46 @@ Example: EQMP { + .name = "block_job_cancel", + .args_type = "device:B", + .params = "device", + .user_print = monitor_user_noop, + .mhandler.cmd_new = do_block_job_cancel, + }, + +SQMP + +block_job_cancel +---------------- + +Stop an active block streaming operation. + +This command returns once the active block streaming operation has been +stopped. It is an error to call this command if no operation is in progress. + +The image file retains its backing file unless the streaming operation happens +to complete just as it is being cancelled. + +A new block streaming operation can be started at a later time to finish +copying all data from the backing file. + +Arguments: + +- device: device name (json-string) + +Errors: + +DeviceNotActive: streaming is not active on this device +DeviceInUse: cancellation already in progress + +Examples: + +-> { "execute": "block_job_cancel", "arguments": { "device": "virtio0" } } +<- { "return": {} } + +EQMP + + { .name = "blockdev-snapshot-sync", .args_type = "device:B,snapshot-file:s?,format:s?", .params = "device [new-image-file] [format]", -- 1.7.5.4