[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/9] qmp: add qmp cmd block-dirty-bitmap-copy
From: |
John Snow |
Subject: |
[Qemu-devel] [PATCH 5/9] qmp: add qmp cmd block-dirty-bitmap-copy |
Date: |
Thu, 4 Jun 2015 20:20:38 -0400 |
Add the ability to copy one bitmap to a new bitmap.
Signed-off-by: John Snow <address@hidden>
---
blockdev.c | 22 ++++++++++++++++++++++
qapi/block-core.json | 16 ++++++++++++++++
qmp-commands.hx | 30 ++++++++++++++++++++++++++++++
3 files changed, 68 insertions(+)
diff --git a/blockdev.c b/blockdev.c
index 905bf84..9233bcd 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2445,6 +2445,28 @@ void qmp_block_dirty_bitmap_add(const char *node, const
char *name,
aio_context_release(aio_context);
}
+void qmp_block_dirty_bitmap_copy(const char *node, const char *source,
+ const char *dest, Error **errp)
+{
+ AioContext *aio_context;
+ BlockDriverState *bs;
+ BdrvDirtyBitmap *bitmap;
+
+ if (!dest || dest[0] == '\0') {
+ error_setg(errp, "Bitmap name cannot be empty");
+ return;
+ }
+
+ bitmap = block_dirty_bitmap_lookup(node, source, &bs, &aio_context, errp);
+ if (!bitmap || !bs) {
+ return;
+ }
+
+ /* Duplicate name checking is left to bdrv_copy_dirty_bitmap */
+ bdrv_copy_dirty_bitmap(bs, bitmap, dest, errp);
+ aio_context_release(aio_context);
+}
+
void qmp_block_dirty_bitmap_remove(const char *node, const char *name,
Error **errp)
{
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 6bed205..92c9e53 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -1043,6 +1043,22 @@
'data': 'BlockDirtyBitmapAdd' }
##
+# @block-dirty-bitmap-copy
+#
+# Copy a dirty bitmap into a new dirty bitmap
+#
+# Returns: nothing on success
+# If @node is not a valid block device or node, DeviceNotFound
+# If @source is not a valid bitmap, GenericError
+# if @dest is not a valid bitmap name, GenericError
+# if @dest is already taken, GenericError
+#
+# Since 2.4
+##
+{ 'command': 'block-dirty-bitmap-copy',
+ 'data': 'BlockDirtyBitmapCopy' }
+
+##
# @block-dirty-bitmap-remove
#
# Remove a dirty bitmap on the node
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 1e74188..9818b3f 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -1347,6 +1347,36 @@ Example:
EQMP
{
+ .name = "block-dirty-bitmap-copy",
+ .args_type = "node:B,source:s,dest:s",
+ .mhandler.cmd_new = qmp_marshal_input_block_dirty_bitmap_copy,
+ },
+
+SQMP
+
+block-dirty-bitmap-copy
+-----------------------
+Since 2.4
+
+Copy a dirty bitmap from 'source' to a new bitmap 'dest', then start tracking
+new writes immediately.
+
+Arguments:
+
+- "node": device/node on which to create dirty bitmap (json-string)
+- "source": name of the dirty bitmap to be copied (json-string)
+- "dest": name of the dirty bitmap to be copied (json-string)
+
+Example:
+
+-> { "execute": "block-dirty-bitmap-copy", "arguments": { "node": "drive0",
+ "source": "bitmap0",
+ "dest": "bitmap1" } }
+<- { "return": {} }
+
+EQMP
+
+ {
.name = "block-dirty-bitmap-remove",
.args_type = "node:B,name:s",
.mhandler.cmd_new = qmp_marshal_input_block_dirty_bitmap_remove,
--
2.1.0
- [Qemu-devel] [PATCH 0/9] block: add differential backup support, John Snow, 2015/06/04
- [Qemu-devel] [PATCH 2/9] hbitmap: add hbitmap_copy, John Snow, 2015/06/04
- [Qemu-devel] [PATCH 3/9] block: add bdrv_copy_dirty_bitmap, John Snow, 2015/06/04
- [Qemu-devel] [PATCH 1/9] qapi: Rename 'dirty-bitmap' mode to 'incremental', John Snow, 2015/06/04
- [Qemu-devel] [PATCH 4/9] qapi: add Copy data type for bitmaps, John Snow, 2015/06/04
- [Qemu-devel] [PATCH 5/9] qmp: add qmp cmd block-dirty-bitmap-copy,
John Snow <=
- [Qemu-devel] [PATCH 6/9] qmp: add block-dirty-bitmap-copy transaction, John Snow, 2015/06/04
- [Qemu-devel] [PATCH 7/9] block: add differential backup mode, John Snow, 2015/06/04
- [Qemu-devel] [PATCH 9/9] iotests: add differential backup test, John Snow, 2015/06/04
- [Qemu-devel] [PATCH 8/9] iotests: 124: support differential backups, John Snow, 2015/06/04
- Re: [Qemu-devel] [PATCH 0/9] block: add differential backup support, John Snow, 2015/06/23