27.04.2021 14:11, Vladimir Sementsov-Ogievskiy wrote:
Add possibility to merge allocation map of specified node into target
bitmap.
Signed-off-by: Vladimir Sementsov-Ogievskiy<vsement...@virtuozzo.com>
---
qapi/block-core.json | 31 +++++++++++++++++--
include/block/block_int.h | 4 +++
block/dirty-bitmap.c | 42 +++++++++++++++++++++++++
block/monitor/bitmap-qmp-cmds.c | 55 ++++++++++++++++++++++++++++-----
4 files changed, 122 insertions(+), 10 deletions(-)
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 6d227924d0..0fafb043bc 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -2006,6 +2006,32 @@
'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
'*persistent': 'bool', '*disabled': 'bool' } }
+##
+# @AllocationMapMode:
+#
+# An enumeration of possible allocation maps that could be merged into target
+# bitmap.
+#
+# @top: The allocation status of the top layer of the attached storage node.
+#
+# Since: 6.1
+##
+{ 'enum': 'AllocationMapMode',
+ 'data': ['top'] }
+
+##
+# @BlockDirtyBitmapMergeExternalSource:
+#
+# @node: name of device/node which the bitmap is tracking
+#
+# @name: name of the dirty bitmap
+#
+# Since: 6.1
+##
+{ 'struct': 'BlockDirtyBitmapMergeExternalSource',
+ 'data': { 'node': 'str', '*name': 'str',
+ '*allocation-map': 'AllocationMapMode' } }
+
##
# @BlockDirtyBitmapMergeSource:
#
@@ -2017,7 +2043,7 @@
##
{ 'alternate': 'BlockDirtyBitmapMergeSource',
'data': { 'local': 'str',
- 'external': 'BlockDirtyBitmap' } }
+ 'external': 'BlockDirtyBitmapMergeExternalSource' } }
##
# @BlockDirtyBitmapMerge:
@@ -2176,7 +2202,8 @@
#
##
{ 'command': 'block-dirty-bitmap-merge',
- 'data': 'BlockDirtyBitmapMerge' }
+ 'data': 'BlockDirtyBitmapMerge',
+ 'coroutine': true }
##
So, what I propose makes possible to issue the following command:
block-dirty-bitmap-merge
bitmaps: [{"allocation-map": "top", "node": "drive0"}]
node: target-node-name
target: target-bitmap-name
I've discussed it with Nikolay, and he requested a possibility of querying
allocation status of base..top sub-chain (assume several snapshots was done
without creating bitmaps, and we want to restore the bitmap for backup).
So, we actually want something like
block-dirty-bitmap-merge
bitmaps: [{top: "tpp-node-name", bottom: "bottom-node-name"}]
node: target-node-name
target: target-bitmap-name
--
Best regards,
Vladimir