|
|
77c23f |
From 58816c3709e5058e8805333ca011cc4e793d67ff Mon Sep 17 00:00:00 2001
|
|
|
77c23f |
From: Eric Blake <eblake@redhat.com>
|
|
|
77c23f |
Date: Tue, 2 Jun 2020 02:34:18 +0100
|
|
|
77c23f |
Subject: [PATCH 13/26] qemu-img: Factor out code for merging bitmaps
|
|
|
77c23f |
MIME-Version: 1.0
|
|
|
77c23f |
Content-Type: text/plain; charset=UTF-8
|
|
|
77c23f |
Content-Transfer-Encoding: 8bit
|
|
|
77c23f |
|
|
|
77c23f |
RH-Author: Eric Blake <eblake@redhat.com>
|
|
|
77c23f |
Message-id: <20200602023420.2133649-11-eblake@redhat.com>
|
|
|
77c23f |
Patchwork-id: 97078
|
|
|
77c23f |
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 10/12] qemu-img: Factor out code for merging bitmaps
|
|
|
77c23f |
Bugzilla: 1779893 1779904
|
|
|
77c23f |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
77c23f |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
77c23f |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
77c23f |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
77c23f |
|
|
|
77c23f |
The next patch will add another client that wants to merge dirty
|
|
|
77c23f |
bitmaps; it will be easier to refactor the code to construct the QAPI
|
|
|
77c23f |
struct correctly into a helper function.
|
|
|
77c23f |
|
|
|
77c23f |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
77c23f |
Message-Id: <20200521192137.1120211-4-eblake@redhat.com>
|
|
|
77c23f |
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
77c23f |
(cherry picked from commit 6c729dd832207d7347ecb074912f538e2942f269)
|
|
|
77c23f |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
77c23f |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
77c23f |
---
|
|
|
77c23f |
qemu-img.c | 34 +++++++++++++++++++++-------------
|
|
|
77c23f |
1 file changed, 21 insertions(+), 13 deletions(-)
|
|
|
77c23f |
|
|
|
77c23f |
diff --git a/qemu-img.c b/qemu-img.c
|
|
|
77c23f |
index b57856e..39e1586 100644
|
|
|
77c23f |
--- a/qemu-img.c
|
|
|
77c23f |
+++ b/qemu-img.c
|
|
|
77c23f |
@@ -1582,6 +1582,24 @@ out4:
|
|
|
77c23f |
return ret;
|
|
|
77c23f |
}
|
|
|
77c23f |
|
|
|
77c23f |
+/* Convenience wrapper around qmp_block_dirty_bitmap_merge */
|
|
|
77c23f |
+static void do_dirty_bitmap_merge(const char *dst_node, const char *dst_name,
|
|
|
77c23f |
+ const char *src_node, const char *src_name,
|
|
|
77c23f |
+ Error **errp)
|
|
|
77c23f |
+{
|
|
|
77c23f |
+ BlockDirtyBitmapMergeSource *merge_src;
|
|
|
77c23f |
+ BlockDirtyBitmapMergeSourceList *list;
|
|
|
77c23f |
+
|
|
|
77c23f |
+ merge_src = g_new0(BlockDirtyBitmapMergeSource, 1);
|
|
|
77c23f |
+ merge_src->type = QTYPE_QDICT;
|
|
|
77c23f |
+ merge_src->u.external.node = g_strdup(src_node);
|
|
|
77c23f |
+ merge_src->u.external.name = g_strdup(src_name);
|
|
|
77c23f |
+ list = g_new0(BlockDirtyBitmapMergeSourceList, 1);
|
|
|
77c23f |
+ list->value = merge_src;
|
|
|
77c23f |
+ qmp_block_dirty_bitmap_merge(dst_node, dst_name, list, errp);
|
|
|
77c23f |
+ qapi_free_BlockDirtyBitmapMergeSourceList(list);
|
|
|
77c23f |
+}
|
|
|
77c23f |
+
|
|
|
77c23f |
enum ImgConvertBlockStatus {
|
|
|
77c23f |
BLK_DATA,
|
|
|
77c23f |
BLK_ZERO,
|
|
|
77c23f |
@@ -4614,21 +4632,11 @@ static int img_bitmap(int argc, char **argv)
|
|
|
77c23f |
qmp_block_dirty_bitmap_disable(bs->node_name, bitmap, &err;;
|
|
|
77c23f |
op = "disable";
|
|
|
77c23f |
break;
|
|
|
77c23f |
- case BITMAP_MERGE: {
|
|
|
77c23f |
- BlockDirtyBitmapMergeSource *merge_src;
|
|
|
77c23f |
- BlockDirtyBitmapMergeSourceList *list;
|
|
|
77c23f |
-
|
|
|
77c23f |
- merge_src = g_new0(BlockDirtyBitmapMergeSource, 1);
|
|
|
77c23f |
- merge_src->type = QTYPE_QDICT;
|
|
|
77c23f |
- merge_src->u.external.node = g_strdup(src_bs->node_name);
|
|
|
77c23f |
- merge_src->u.external.name = g_strdup(act->src);
|
|
|
77c23f |
- list = g_new0(BlockDirtyBitmapMergeSourceList, 1);
|
|
|
77c23f |
- list->value = merge_src;
|
|
|
77c23f |
- qmp_block_dirty_bitmap_merge(bs->node_name, bitmap, list, &err;;
|
|
|
77c23f |
- qapi_free_BlockDirtyBitmapMergeSourceList(list);
|
|
|
77c23f |
+ case BITMAP_MERGE:
|
|
|
77c23f |
+ do_dirty_bitmap_merge(bs->node_name, bitmap, src_bs->node_name,
|
|
|
77c23f |
+ act->src, &err;;
|
|
|
77c23f |
op = "merge";
|
|
|
77c23f |
break;
|
|
|
77c23f |
- }
|
|
|
77c23f |
default:
|
|
|
77c23f |
g_assert_not_reached();
|
|
|
77c23f |
}
|
|
|
77c23f |
--
|
|
|
77c23f |
1.8.3.1
|
|
|
77c23f |
|