From 341ebc2f81b14862347e4d4c1fcb3759f815237a Mon Sep 17 00:00:00 2001 From: John Snow Date: Fri, 17 Apr 2015 19:49:52 -0400 Subject: qmp: Add block-dirty-bitmap-add and block-dirty-bitmap-remove The new command pair is added to manage a user created dirty bitmap. The dirty bitmap's name is mandatory and must be unique for the same device, but different devices can have bitmaps with the same names. The granularity is an optional field. If it is not specified, we will choose a default granularity based on the cluster size if available, clamped to between 4K and 64K to mirror how the 'mirror' code was already choosing granularity. If we do not have cluster size info available, we choose 64K. This code has been factored out into a helper shared with block/mirror. This patch also introduces the 'block_dirty_bitmap_lookup' helper, which takes a device name and a dirty bitmap name and validates the lookup, returning NULL and setting errp if there is a problem with either field. This helper will be re-used in future patches in this series. The types added to block-core.json will be re-used in future patches in this series, see: 'qapi: Add transaction support to block-dirty-bitmap-{add, enable, disable}' Signed-off-by: John Snow Reviewed-by: Max Reitz Reviewed-by: Stefan Hajnoczi Reviewed-by: Eric Blake Message-id: 1429314609-29776-5-git-send-email-jsnow@redhat.com Signed-off-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- qapi/block-core.json | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'qapi') diff --git a/qapi/block-core.json b/qapi/block-core.json index 7dc6441..6237f9d 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -960,6 +960,61 @@ '*on-target-error': 'BlockdevOnError' } } ## +# @BlockDirtyBitmap +# +# @node: name of device/node which the bitmap is tracking +# +# @name: name of the dirty bitmap +# +# Since 2.4 +## +{ 'type': 'BlockDirtyBitmap', + 'data': { 'node': 'str', 'name': 'str' } } + +## +# @BlockDirtyBitmapAdd +# +# @node: name of device/node which the bitmap is tracking +# +# @name: name of the dirty bitmap +# +# @granularity: #optional the bitmap granularity, default is 64k for +# block-dirty-bitmap-add +# +# Since 2.4 +## +{ 'type': 'BlockDirtyBitmapAdd', + 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32' } } + +## +# @block-dirty-bitmap-add +# +# Create a dirty bitmap with a name on the node +# +# Returns: nothing on success +# If @node is not a valid block device or node, DeviceNotFound +# If @name is already taken, GenericError with an explanation +# +# Since 2.4 +## +{ 'command': 'block-dirty-bitmap-add', + 'data': 'BlockDirtyBitmapAdd' } + +## +# @block-dirty-bitmap-remove +# +# Remove a dirty bitmap on the node +# +# Returns: nothing on success +# If @node is not a valid block device or node, DeviceNotFound +# If @name is not found, GenericError with an explanation +# +# Since 2.4 +## +{ 'command': 'block-dirty-bitmap-remove', + 'data': 'BlockDirtyBitmap' } + +## # @block_set_io_throttle: # # Change I/O throttle limits for a block drive. -- cgit v1.1