|
|
357786 |
From 65fa69814f994a95b1574dd16ea81aef4774fec5 Mon Sep 17 00:00:00 2001
|
|
|
357786 |
From: John Snow <jsnow@redhat.com>
|
|
|
357786 |
Date: Wed, 18 Jul 2018 22:54:38 +0200
|
|
|
357786 |
Subject: [PATCH 53/89] qapi: add x-block-dirty-bitmap-enable/disable
|
|
|
357786 |
|
|
|
357786 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
357786 |
Message-id: <20180718225511.14878-3-jsnow@redhat.com>
|
|
|
357786 |
Patchwork-id: 81406
|
|
|
357786 |
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 02/35] qapi: add x-block-dirty-bitmap-enable/disable
|
|
|
357786 |
Bugzilla: 1207657
|
|
|
357786 |
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
|
|
357786 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
357786 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
357786 |
|
|
|
357786 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
357786 |
|
|
|
357786 |
Expose the ability to turn bitmaps "on" or "off". This is experimental
|
|
|
357786 |
and principally for the sake of the Libvirt Checkpoints API, and it may
|
|
|
357786 |
or may not be committed for 3.0.
|
|
|
357786 |
|
|
|
357786 |
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
357786 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
357786 |
Reviewed-by: Jeff Cody <jcody@redhat.com>
|
|
|
357786 |
Message-id: 20180606182449.1607-3-jsnow@redhat.com
|
|
|
357786 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
357786 |
(cherry picked from commit 5c5d2e50e5ac85234d793f0127a20ea3424a1229)
|
|
|
357786 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
357786 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
357786 |
---
|
|
|
357786 |
blockdev.c | 42 ++++++++++++++++++++++++++++++++++++++++++
|
|
|
357786 |
qapi/block-core.json | 42 ++++++++++++++++++++++++++++++++++++++++++
|
|
|
357786 |
2 files changed, 84 insertions(+)
|
|
|
357786 |
|
|
|
357786 |
diff --git a/blockdev.c b/blockdev.c
|
|
|
357786 |
index d8b6520..ca2ffff 100644
|
|
|
357786 |
--- a/blockdev.c
|
|
|
357786 |
+++ b/blockdev.c
|
|
|
357786 |
@@ -2965,6 +2965,48 @@ void qmp_block_dirty_bitmap_clear(const char *node, const char *name,
|
|
|
357786 |
bdrv_clear_dirty_bitmap(bitmap, NULL);
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
+void qmp_x_block_dirty_bitmap_enable(const char *node, const char *name,
|
|
|
357786 |
+ Error **errp)
|
|
|
357786 |
+{
|
|
|
357786 |
+ BlockDriverState *bs;
|
|
|
357786 |
+ BdrvDirtyBitmap *bitmap;
|
|
|
357786 |
+
|
|
|
357786 |
+ bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
|
|
|
357786 |
+ if (!bitmap) {
|
|
|
357786 |
+ return;
|
|
|
357786 |
+ }
|
|
|
357786 |
+
|
|
|
357786 |
+ if (bdrv_dirty_bitmap_frozen(bitmap)) {
|
|
|
357786 |
+ error_setg(errp,
|
|
|
357786 |
+ "Bitmap '%s' is currently frozen and cannot be enabled",
|
|
|
357786 |
+ name);
|
|
|
357786 |
+ return;
|
|
|
357786 |
+ }
|
|
|
357786 |
+
|
|
|
357786 |
+ bdrv_enable_dirty_bitmap(bitmap);
|
|
|
357786 |
+}
|
|
|
357786 |
+
|
|
|
357786 |
+void qmp_x_block_dirty_bitmap_disable(const char *node, const char *name,
|
|
|
357786 |
+ Error **errp)
|
|
|
357786 |
+{
|
|
|
357786 |
+ BlockDriverState *bs;
|
|
|
357786 |
+ BdrvDirtyBitmap *bitmap;
|
|
|
357786 |
+
|
|
|
357786 |
+ bitmap = block_dirty_bitmap_lookup(node, name, &bs, errp);
|
|
|
357786 |
+ if (!bitmap) {
|
|
|
357786 |
+ return;
|
|
|
357786 |
+ }
|
|
|
357786 |
+
|
|
|
357786 |
+ if (bdrv_dirty_bitmap_frozen(bitmap)) {
|
|
|
357786 |
+ error_setg(errp,
|
|
|
357786 |
+ "Bitmap '%s' is currently frozen and cannot be disabled",
|
|
|
357786 |
+ name);
|
|
|
357786 |
+ return;
|
|
|
357786 |
+ }
|
|
|
357786 |
+
|
|
|
357786 |
+ bdrv_disable_dirty_bitmap(bitmap);
|
|
|
357786 |
+}
|
|
|
357786 |
+
|
|
|
357786 |
BlockDirtyBitmapSha256 *qmp_x_debug_block_dirty_bitmap_sha256(const char *node,
|
|
|
357786 |
const char *name,
|
|
|
357786 |
Error **errp)
|
|
|
357786 |
diff --git a/qapi/block-core.json b/qapi/block-core.json
|
|
|
357786 |
index 0b07e41..5c8cfa3 100644
|
|
|
357786 |
--- a/qapi/block-core.json
|
|
|
357786 |
+++ b/qapi/block-core.json
|
|
|
357786 |
@@ -1809,6 +1809,48 @@
|
|
|
357786 |
'data': 'BlockDirtyBitmap' }
|
|
|
357786 |
|
|
|
357786 |
##
|
|
|
357786 |
+# @x-block-dirty-bitmap-enable:
|
|
|
357786 |
+#
|
|
|
357786 |
+# Enables a dirty bitmap so that it will begin tracking disk changes.
|
|
|
357786 |
+#
|
|
|
357786 |
+# Returns: nothing on success
|
|
|
357786 |
+# If @node is not a valid block device, DeviceNotFound
|
|
|
357786 |
+# If @name is not found, GenericError with an explanation
|
|
|
357786 |
+#
|
|
|
357786 |
+# Since: 3.0
|
|
|
357786 |
+#
|
|
|
357786 |
+# Example:
|
|
|
357786 |
+#
|
|
|
357786 |
+# -> { "execute": "x-block-dirty-bitmap-enable",
|
|
|
357786 |
+# "arguments": { "node": "drive0", "name": "bitmap0" } }
|
|
|
357786 |
+# <- { "return": {} }
|
|
|
357786 |
+#
|
|
|
357786 |
+##
|
|
|
357786 |
+ { 'command': 'x-block-dirty-bitmap-enable',
|
|
|
357786 |
+ 'data': 'BlockDirtyBitmap' }
|
|
|
357786 |
+
|
|
|
357786 |
+##
|
|
|
357786 |
+# @x-block-dirty-bitmap-disable:
|
|
|
357786 |
+#
|
|
|
357786 |
+# Disables a dirty bitmap so that it will stop tracking disk changes.
|
|
|
357786 |
+#
|
|
|
357786 |
+# Returns: nothing on success
|
|
|
357786 |
+# If @node is not a valid block device, DeviceNotFound
|
|
|
357786 |
+# If @name is not found, GenericError with an explanation
|
|
|
357786 |
+#
|
|
|
357786 |
+# Since: 3.0
|
|
|
357786 |
+#
|
|
|
357786 |
+# Example:
|
|
|
357786 |
+#
|
|
|
357786 |
+# -> { "execute": "x-block-dirty-bitmap-disable",
|
|
|
357786 |
+# "arguments": { "node": "drive0", "name": "bitmap0" } }
|
|
|
357786 |
+# <- { "return": {} }
|
|
|
357786 |
+#
|
|
|
357786 |
+##
|
|
|
357786 |
+ { 'command': 'x-block-dirty-bitmap-disable',
|
|
|
357786 |
+ 'data': 'BlockDirtyBitmap' }
|
|
|
357786 |
+
|
|
|
357786 |
+##
|
|
|
357786 |
# @BlockDirtyBitmapSha256:
|
|
|
357786 |
#
|
|
|
357786 |
# SHA256 hash of dirty bitmap data
|
|
|
357786 |
--
|
|
|
357786 |
1.8.3.1
|
|
|
357786 |
|