aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2018-06-11 14:53:32 -0400
committerJohn Snow <jsnow@redhat.com>2018-06-11 14:53:32 -0400
commitb598e531f1123d2fb72615f1161c66093be751ea (patch)
tree0b49f40ac59b8c19d6f46efb5a4875058b48742a /blockdev.c
parentc6490447402f574bbe45f45c318e0bdd19121baf (diff)
qapi: add x-block-dirty-bitmap-merge
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Message-id: 20180606182449.1607-5-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/blockdev.c b/blockdev.c
index 2ac15601d9..dcb7a6d54e 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3043,6 +3043,36 @@ void qmp_x_block_dirty_bitmap_disable(const char *node, const char *name,
bdrv_disable_dirty_bitmap(bitmap);
}
+void qmp_x_block_dirty_bitmap_merge(const char *node, const char *dst_name,
+ const char *src_name, Error **errp)
+{
+ BlockDriverState *bs;
+ BdrvDirtyBitmap *dst, *src;
+
+ dst = block_dirty_bitmap_lookup(node, dst_name, &bs, errp);
+ if (!dst) {
+ return;
+ }
+
+ if (bdrv_dirty_bitmap_frozen(dst)) {
+ error_setg(errp, "Bitmap '%s' is frozen and cannot be modified",
+ dst_name);
+ return;
+ } else if (bdrv_dirty_bitmap_readonly(dst)) {
+ error_setg(errp, "Bitmap '%s' is readonly and cannot be modified",
+ dst_name);
+ return;
+ }
+
+ src = bdrv_find_dirty_bitmap(bs, src_name);
+ if (!src) {
+ error_setg(errp, "Dirty bitmap '%s' not found", src_name);
+ return;
+ }
+
+ bdrv_merge_dirty_bitmap(dst, src, errp);
+}
+
BlockDirtyBitmapSha256 *qmp_x_debug_block_dirty_bitmap_sha256(const char *node,
const char *name,
Error **errp)