[libvirt] [PATCH v2] qapi: add dirty-bitmaps to query-named-block-nodes result

John Snow posted 1 patch 4 years, 9 months ago
Test FreeBSD passed
Test asan passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test checkpatch passed
Test s390x passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190716011344.25380-1-jsnow@redhat.com
Maintainers: Eric Blake <eblake@redhat.com>, Max Reitz <mreitz@redhat.com>, Markus Armbruster <armbru@redhat.com>, Kevin Wolf <kwolf@redhat.com>
There is a newer version of this series
block/qapi.c         |  5 +++++
qapi/block-core.json | 14 +++++++++++++-
qemu-deprecated.texi | 12 ++++++++++++
3 files changed, 30 insertions(+), 1 deletion(-)
[libvirt] [PATCH v2] qapi: add dirty-bitmaps to query-named-block-nodes result
Posted by John Snow 4 years, 9 months ago
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

Let's add a possibility to query dirty-bitmaps not only on root nodes.
It is useful when dealing both with snapshots and incremental backups.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
[Added deprecation and feature flag information. --js]
Signed-off-by: John Snow <jsnow@redhat.com>
---
 block/qapi.c         |  5 +++++
 qapi/block-core.json | 14 +++++++++++++-
 qemu-deprecated.texi | 12 ++++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/block/qapi.c b/block/qapi.c
index 917435f022..15f1030264 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -79,6 +79,11 @@ BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
         info->backing_file = g_strdup(bs->backing_file);
     }
 
+    if (!QLIST_EMPTY(&bs->dirty_bitmaps)) {
+        info->has_dirty_bitmaps = true;
+        info->dirty_bitmaps = bdrv_query_dirty_bitmaps(bs);
+    }
+
     info->detect_zeroes = bs->detect_zeroes;
 
     if (blk && blk_get_public(blk)->throttle_group_member.throttle_state) {
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 0d43d4f37c..0d67dd245c 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -360,6 +360,16 @@
 # @write_threshold: configured write threshold for the device.
 #                   0 if disabled. (Since 2.3)
 #
+# @dirty-bitmaps: dirty bitmaps information (only present if node
+#                 has one or more dirty bitmaps) (Since 4.2)
+#
+# Features:
+# @node-dirty-bitmaps: Signals the capability to return dirty bitmap information
+#                      per-node instead of per-drive. If this flag is present,
+#                      dirty-bitmaps should not be read from the BlockInfo
+#                      structure, the top-level data for query-block.
+#                      (Since 4.2)
+#
 # Since: 0.14.0
 #
 ##
@@ -378,7 +388,8 @@
             '*bps_wr_max_length': 'int', '*iops_max_length': 'int',
             '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int',
             '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo',
-            'write_threshold': 'int' } }
+            'write_threshold': 'int', '*dirty-bitmaps': ['BlockDirtyInfo'] },
+  'features': [ { 'name': 'node-dirty-bitmaps' } ] }
 
 ##
 # @BlockDeviceIoStatus:
@@ -656,6 +667,7 @@
 #
 # @dirty-bitmaps: dirty bitmaps information (only present if the
 #                 driver has one or more dirty bitmaps) (Since 2.0)
+#                 Deprecated in 4.2; see BlockDirtyInfo instead.
 #
 # @io-status: @BlockDeviceIoStatus. Only present if the device
 #             supports it and the VM is configured to stop on errors
diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
index c90b08d553..bc4e5ac1d7 100644
--- a/qemu-deprecated.texi
+++ b/qemu-deprecated.texi
@@ -134,6 +134,18 @@ The ``status'' field of the ``BlockDirtyInfo'' structure, returned by
 the query-block command is deprecated. Two new boolean fields,
 ``recording'' and ``busy'' effectively replace it.
 
+@subsection query-block result field dirty-bitmaps (Since 4.2)
+
+The ``dirty-bitmaps`` field of the ``BlockInfo`` structure, returned by
+the query-block command is itself now deprecated. The ``dirty-bitmaps``
+field of the ``BlockDeviceInfo`` struct should be used instead, which is the
+type of the ``inserted`` field in query-block replies, as well as the
+type of array items in query-named-block-nodes.
+
+In the absence of bitmaps on either structure, management APIs may use the
+presence of the ``node-dirty-bitmaps`` feature flag on the ``BlockDeviceInfo``
+structure to know where to anticipate bitmap data when present.
+
 @subsection query-cpus (since 2.12.0)
 
 The ``query-cpus'' command is replaced by the ``query-cpus-fast'' command.
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list