From patchwork Wed Feb 6 12:32:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Beno=C3=AEt_Canet?= X-Patchwork-Id: 218643 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C15DC2C02AE for ; Thu, 7 Feb 2013 01:26:35 +1100 (EST) Received: from localhost ([::1]:51442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U35xJ-0000Hu-S1 for incoming@patchwork.ozlabs.org; Wed, 06 Feb 2013 09:26:33 -0500 Received: from eggs.gnu.org ([208.118.235.92]:56795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U34E0-0000bz-Ac for qemu-devel@nongnu.org; Wed, 06 Feb 2013 07:35:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U34Dv-00061E-G2 for qemu-devel@nongnu.org; Wed, 06 Feb 2013 07:35:40 -0500 Received: from nodalink.pck.nerim.net ([62.212.105.220]:43791 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U34Dv-000619-54 for qemu-devel@nongnu.org; Wed, 06 Feb 2013 07:35:35 -0500 Received: by paradis.irqsave.net (Postfix, from userid 1002) id 8B61787430E; Wed, 6 Feb 2013 13:35:34 +0100 (CET) Received: from localhost.localdomain (unknown [192.168.77.1]) by paradis.irqsave.net (Postfix) with ESMTP id 3C597874354; Wed, 6 Feb 2013 13:31:41 +0100 (CET) From: =?UTF-8?q?Beno=C3=AEt=20Canet?= To: qemu-devel@nongnu.org Date: Wed, 6 Feb 2013 13:32:26 +0100 Message-Id: <1360153946-9617-8-git-send-email-benoit@irqsave.net> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360153946-9617-1-git-send-email-benoit@irqsave.net> References: <1360153946-9617-1-git-send-email-benoit@irqsave.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 62.212.105.220 Cc: kwolf@redhat.com, =?UTF-8?q?Beno=C3=AEt=20Canet?= , stefanha@redhat.com Subject: [Qemu-devel] [RFC V2 7/7] qmp: Add block-dedup-control. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org --- blockdev.c | 20 ++++++++++++++++++++ qapi-schema.json | 19 +++++++++++++++++++ qmp-commands.hx | 25 +++++++++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/blockdev.c b/blockdev.c index 63e6f1e..44e9e58 100644 --- a/blockdev.c +++ b/blockdev.c @@ -897,6 +897,26 @@ void qmp_block_passwd(const char *device, const char *password, Error **errp) } } +void qmp_block_dedup_control(const char *device, const bool enable, + Error **errp) +{ + BlockDriverState *bs; + int err; + + bs = bdrv_find(device); + if (!bs) { + error_set(errp, QERR_DEVICE_NOT_FOUND, device); + return; + } + + err = bdrv_dedup_control(bs, enable); + if (err == -EINVAL) { + error_setg(errp, "Device '%s' doesn't support deduplication", + bdrv_get_device_name(bs)); + return; + } +} + static void qmp_bdrv_open_encrypted(BlockDriverState *bs, const char *filename, int bdrv_flags, BlockDriver *drv, const char *password, Error **errp) diff --git a/qapi-schema.json b/qapi-schema.json index ec61f6a..f861f00 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -812,6 +812,25 @@ ## { 'enum': 'DedupStatus', 'data': [ 'stopped', 'starting', 'started', 'stopping' ] } +## +# @block-dedup-control: +# +# This command pause the deduplication on a device that supports it. +# +# @device: the name of the device to control the deduplication for +# @enable: true to start, false to stop +# +# Returns: nothing on success +# If @device is not a valid block device, DeviceNotFound +# GenericError if @device is not deduplicated +# +# Notes: Not all block formats support deduplication one must use +# query-blockstats before and look at the optional deduplication field. +# +# Since: 1.5 +## +{ 'command': 'block-dedup-control', + 'data': {'device': 'str', 'enable': 'bool' } } ## # @BlockDeviceDedupInfo diff --git a/qmp-commands.hx b/qmp-commands.hx index bbb21f3..9c53e16 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1310,6 +1310,31 @@ Example: EQMP { + .name = "block-dedup-control", + .args_type = "device:B,enable:b", + .mhandler.cmd_new = qmp_marshal_input_block_dedup_control, + }, + +SQMP +block-dedup-control +------------ + +Start or stop the deduplication on a device that support it. + +Arguments: + +- "device": device name (json-string) +- "enable": true to start, false to stop (json-bool) + +Example: + +-> { "execute": "block-dedup-control", + "arguments": { "device": "ide0-hd0", "enable": false } } +<- { "return": {} } + +EQMP + + { .name = "block_set_io_throttle", .args_type = "device:B,bps:l,bps_rd:l,bps_wr:l,iops:l,iops_rd:l,iops_wr:l", .mhandler.cmd_new = qmp_marshal_input_block_set_io_throttle,