qapi: add dirty-bitmaps to query-named-block-nodes result
PATCH 1/1 qapi: add dirty-bitmaps to query-named-block-nodes result
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.
--- qapi/block-core.json | 5 ++++- block/qapi.c | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-)
qapi/block-core.json +4 -1
@@ -360,6 +360,9 @@ # @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.1) +# # Since: 0.14.0 # ##
@@ -378,7 +381,7 @@ '*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'] } } ## # @BlockDeviceIoStatus:
block/qapi.c +5 -0
@@ -78,6 +78,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) {
Signature · 1 line
2.18.0
Quoted 8 lines · Vladimir Sementsov-Ogievskiy
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 <[email protected]>--- qapi/block-core.json | 5 ++++- block/qapi.c | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-)
Indeed useful.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 39 lines · Vladimir Sementsov-Ogievskiy
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 <[email protected]>--- qapi/block-core.json | 5 ++++- block/qapi.c | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-)qapi/block-core.json +4
-1@@ -360,6 +360,9 @@ # @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.1) +# # Since: 0.14.0 # ##@@ -378,7 +381,7 @@ '*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'] } } ## # @BlockDeviceIoStatus:block/qapi.c +0
-0@@ -78,6 +78,11 @@ BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, info->backing_file =g_strdup (bs->backing_file);
block/qapi.c BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, · line 88
Quoted 10 lines
block/qapi.c +5
-0} +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) {
So query-block uses bdrv_query_info, which calls bdrv_block_device_info, so we'll duplicate the bitmap output when doing the old-fashioned block query, but that's probably harmless overall.
We can continue to support the output in both places, or we could opt to deprecate the older interface; I think this is one of the last chances we'd get to do so before libvirt and wider adoption.
I think that's probably Eric's choice.
Quoted 19 lines · John Snow
Quoted 16 lines · Vladimir Sementsov-Ogievskiy
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.
+++
b/block/qapi.cblock/qapi.c +5
-0@@ -78,6 +78,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;
Quoted 6 lines
block/qapi.c BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, · line 88
Quoted 2 lines
block/qapi.c +0
-0if (blk &&blk_get_public (blk)->throttle_group_member.throttle_state) {So query-block uses
bdrv_query_info, which callsbdrv_block_device_info, so we'll duplicate the bitmap output when doing the old-fashioned block query, but that's probably harmless overall.
We already know that none of our existing query- interfaces are sane (either too little information, or too much). Duplication starts to push an interface towards too much (it takes processor time to bundle up the extra JSON, especially if the other end is not going to care if it was present). I know Kevin still has somewhere on his to-do list the implementation of a saner query- command for the information we really want (about each block, without redundant information, and where we don't repeat information in a nested manner, but where we also don't omit information that would otherwise require multiple existing query- to reconstruct).
Quoted 6 lines
We can continue to support the output in both places, or we could opt to deprecate the older interface; I think this is one of the last chances we'd get to do so before libvirt and wider adoption.
I think that's probably Eric's choice.
If you want to try to deprecate the old location, introspection at least works to allow libvirt to know which place to look for it on a given qemu. If you don't think deprecation is necessary, the duplication is probably tolerable for now (as ideally we'd be deprecating ALL of our not-quite-perfect query- block interfaces in favor of whatever sane interface Kevin comes up with).
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 43 lines · Eric Blake
Quoted 19 lines · John Snow
Quoted 16 lines · Vladimir Sementsov-Ogievskiy
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.
+++
b/block/qapi.cblock/qapi.c +5
-0@@ -78,6 +78,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;Quoted 6 lines
block/qapi.c BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, · line 88
Quoted 2 lines
block/qapi.c +0
-0if (blk &&blk_get_public (blk)->throttle_group_member.throttle_state) {So query-block uses
bdrv_query_info, which callsbdrv_block_device_info, so we'll duplicate the bitmap output when doing the old-fashioned block query, but that's probably harmless overall.We already know that none of our existing query- interfaces are sane (either too little information, or too much). Duplication starts to push an interface towards too much (it takes processor time to bundle up the extra JSON, especially if the other end is not going to care if it was present). I know Kevin still has somewhere on his to-do list the implementation of a saner query- command for the information we really want (about each block, without redundant information, and where we don't repeat information in a nested manner, but where we also don't omit information that would otherwise require multiple existing query- to reconstruct).
Quoted 5 lines
We can continue to support the output in both places, or we could opt to deprecate the older interface; I think this is one of the last chances we'd get to do so before libvirt and wider adoption.
Quoted 9 lines
Quoted 1 line
I think that's probably Eric's choice.
If you want to try to deprecate the old location, introspection at least works to allow libvirt to know which place to look for it on a given qemu. If you don't think deprecation is necessary, the duplication is probably tolerable for now (as ideally we'd be deprecating ALL of our not-quite-perfect query- block interfaces in favor of whatever sane interface Kevin comes up with).
It sounds like it's probably the right move to deprecate the entire legacy interface, but still... If you have 20 or 30 bitmaps on a root node, you will see 40 or 60 entries.
What's the smart way to deprecate it? We're not adding new flags or showing new arguments or anything. There might not be bitmaps, so you can't rely on that field being present or absent.
Recommendations?
Quoted 58 lines · John Snow
Quoted 43 lines · Eric Blake
Quoted 19 lines · John Snow
Quoted 16 lines · Vladimir Sementsov-Ogievskiy
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.
+++
b/block/qapi.cblock/qapi.c +5
-0@@ -78,6 +78,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;Quoted 6 lines
block/qapi.c BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, · line 88
Quoted 2 lines
block/qapi.c +0
-0if (blk &&blk_get_public (blk)->throttle_group_member.throttle_state) {So query-block uses
bdrv_query_info, which callsbdrv_block_device_info, so we'll duplicate the bitmap output when doing the old-fashioned block query, but that's probably harmless overall.We already know that none of our existing query- interfaces are sane (either too little information, or too much). Duplication starts to push an interface towards too much (it takes processor time to bundle up the extra JSON, especially if the other end is not going to care if it was present). I know Kevin still has somewhere on his to-do list the implementation of a saner query- command for the information we really want (about each block, without redundant information, and where we don't repeat information in a nested manner, but where we also don't omit information that would otherwise require multiple existing query- to reconstruct).
Quoted 5 lines
We can continue to support the output in both places, or we could opt to deprecate the older interface; I think this is one of the last chances we'd get to do so before libvirt and wider adoption.
Quoted 9 lines
Quoted 1 line
I think that's probably Eric's choice.
If you want to try to deprecate the old location, introspection at least works to allow libvirt to know which place to look for it on a given qemu. If you don't think deprecation is necessary, the duplication is probably tolerable for now (as ideally we'd be deprecating ALL of our not-quite-perfect query- block interfaces in favor of whatever sane interface Kevin comes up with).
It sounds like it's probably the right move to deprecate the entire legacy interface, but still... If you have 20 or 30 bitmaps on a root node, you will see 40 or 60 entries.
Quoted 5 lines
What's the smart way to deprecate it? We're not adding new flags or showing new arguments or anything. There might not be bitmaps, so you can't rely on that field being present or absent.
Recommendations?
Kevin's "[PATCH v4 0/6] file-posix: Add dynamic-auto-read-only QAPI feature" adds "feature flags" to the QAPI schema language, limited to struct types, because that's what he needs. They're visible in introspection. I intend to complete his work, so we can tack "deprecated" feature flags to pretty much anything
Could that address your need?
Quoted 66 lines · Markus Armbruster
Quoted 58 lines · John Snow
Quoted 43 lines · Eric Blake
Quoted 19 lines · John Snow
Quoted 16 lines · Vladimir Sementsov-Ogievskiy
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.
+++
b/block/qapi.cblock/qapi.c +5
-0@@ -78,6 +78,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;Quoted 6 lines
block/qapi.c BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, · line 88
Quoted 2 lines
block/qapi.c +0
-0if (blk &&blk_get_public (blk)->throttle_group_member.throttle_state) {So query-block uses
bdrv_query_info, which callsbdrv_block_device_info, so we'll duplicate the bitmap output when doing the old-fashioned block query, but that's probably harmless overall.We already know that none of our existing query- interfaces are sane (either too little information, or too much). Duplication starts to push an interface towards too much (it takes processor time to bundle up the extra JSON, especially if the other end is not going to care if it was present). I know Kevin still has somewhere on his to-do list the implementation of a saner query- command for the information we really want (about each block, without redundant information, and where we don't repeat information in a nested manner, but where we also don't omit information that would otherwise require multiple existing query- to reconstruct).
Quoted 5 lines
We can continue to support the output in both places, or we could opt to deprecate the older interface; I think this is one of the last chances we'd get to do so before libvirt and wider adoption.
Quoted 9 lines
Quoted 1 line
I think that's probably Eric's choice.
If you want to try to deprecate the old location, introspection at least works to allow libvirt to know which place to look for it on a given qemu. If you don't think deprecation is necessary, the duplication is probably tolerable for now (as ideally we'd be deprecating ALL of our not-quite-perfect query- block interfaces in favor of whatever sane interface Kevin comes up with).
It sounds like it's probably the right move to deprecate the entire legacy interface, but still... If you have 20 or 30 bitmaps on a root node, you will see 40 or 60 entries.
Quoted 5 lines
What's the smart way to deprecate it? We're not adding new flags or showing new arguments or anything. There might not be bitmaps, so you can't rely on that field being present or absent.
Recommendations?
Quoted 8 lines
Kevin's "[PATCH v4 0/6] file-posix: Add dynamic-auto-read-only QAPI feature" adds "feature flags" to the QAPI schema language, limited to struct types, because that's what he needs. They're visible in introspection. I intend to complete his work, so we can tack "deprecated" feature flags to pretty much anything
Could that address your need?
Hi Markus, digging this up again.
In brief, we are displaying bitmap info in the "wrong" part of the query result (attached to drive instead of node) and would like to change it. I'd like to avoid reporting bitmaps in both locations permanently, so if we have a plan to deprecate reporting bitmaps in the old location, I will tolerate the duplicated output temporarily.
Keeping in mind the bitmap fields are optional (so they can be absent from both the new and old locations), what plan can we implement?
Perhaps I can add a feature flag "has-node-bitmaps" for 4.2. Then, for the next three versions, I will report bitmaps from both locations. Then, in 5.2+ I will remove the old location.
A client knows it can find bitmaps (if there are any) in the new location if the feature flag is set. Otherwise, it should look in the old location.
I think I've convinced myself that this is correct, so correct me if I am wrong.
--js
Quoted 73 lines · John Snow
Quoted 72 lines · Markus Armbruster
Quoted 58 lines · John Snow
Quoted 43 lines · Eric Blake
Quoted 19 lines · John Snow
Quoted 16 lines · Vladimir Sementsov-Ogievskiy
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.
+++
b/block/qapi.cblock/qapi.c +5
-0@@ -78,6 +78,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;Quoted 6 lines
block/qapi.c BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, · line 88
Quoted 2 lines
block/qapi.c +0
-0if (blk &&blk_get_public (blk)->throttle_group_member.throttle_state) {So query-block uses
bdrv_query_info, which callsbdrv_block_device_info, so we'll duplicate the bitmap output when doing the old-fashioned block query, but that's probably harmless overall.We already know that none of our existing query- interfaces are sane (either too little information, or too much). Duplication starts to push an interface towards too much (it takes processor time to bundle up the extra JSON, especially if the other end is not going to care if it was present). I know Kevin still has somewhere on his to-do list the implementation of a saner query- command for the information we really want (about each block, without redundant information, and where we don't repeat information in a nested manner, but where we also don't omit information that would otherwise require multiple existing query- to reconstruct).
Quoted 5 lines
We can continue to support the output in both places, or we could opt to deprecate the older interface; I think this is one of the last chances we'd get to do so before libvirt and wider adoption.
Quoted 9 lines
Quoted 1 line
I think that's probably Eric's choice.
If you want to try to deprecate the old location, introspection at least works to allow libvirt to know which place to look for it on a given qemu. If you don't think deprecation is necessary, the duplication is probably tolerable for now (as ideally we'd be deprecating ALL of our not-quite-perfect query- block interfaces in favor of whatever sane interface Kevin comes up with).
It sounds like it's probably the right move to deprecate the entire legacy interface, but still... If you have 20 or 30 bitmaps on a root node, you will see 40 or 60 entries.
Quoted 5 lines
What's the smart way to deprecate it? We're not adding new flags or showing new arguments or anything. There might not be bitmaps, so you can't rely on that field being present or absent.
Recommendations?
Kevin's "[PATCH v4 0/6] file-posix: Add dynamic-auto-read-only QAPI feature" adds "feature flags" to the QAPI schema language, limited to struct types, because that's what he needs. They're visible in introspection. I intend to complete his work, so we can tack "deprecated" feature flags to pretty much anything
Quoted 7 lines
Quoted 2 lines
Could that address your need?
Hi Markus, digging this up again.
In brief, we are displaying bitmap info in the "wrong" part of the query result (attached to drive instead of node) and would like to change it.
I lack context: which query command, which part of its result?
Quoted 3 lines
I'd like to avoid reporting bitmaps in both locations permanently, so if we have a plan to deprecate reporting bitmaps in the old location, I will tolerate the duplicated output temporarily.
How bulky is the bitmap report?
Quoted 2 lines
Keeping in mind the bitmap fields are optional (so they can be absent from both the new and old locations), what plan can we implement?
"Optional" is a syntactic thing, which ought to be backed by a semantic "present iff" condition. Have we specified such conditions?
Quoted 3 lines
Perhaps I can add a feature flag "has-node-bitmaps" for 4.2. Then, for the next three versions, I will report bitmaps from both locations. Then, in 5.2+ I will remove the old location.
For how long has the bitmap been in the "wrong" place? Any known consumers?
Quoted 6 lines
A client knows it can find bitmaps (if there are any) in the new location if the feature flag is set. Otherwise, it should look in the old location.
I think I've convinced myself that this is correct, so correct me if I am wrong.
Sounds like a valid use of feature flags to me. However, feature flags are best used as a last resort. With answers to my questions, I should be able to compare the feature flags solution to possible alternatives.
Quoted 78 lines · Markus Armbruster
Quoted 76 lines · John Snow
Quoted 74 lines · Markus Armbruster
Quoted 58 lines · John Snow
Quoted 43 lines · Eric Blake
Quoted 19 lines · John Snow
Quoted 16 lines · Vladimir Sementsov-Ogievskiy
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.
+++
b/block/qapi.c(quoted diff) +5
-0@@ -78,6 +78,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;Quoted 6 lines
Review BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, · line 88
Quoted 2 lines
(quoted diff) +0
-0if (blk && blk_get_public(blk)->throttle_group_member.throttle_state) {So query-block uses
bdrv_query_info, which callsbdrv_block_device_info, so we'll duplicate the bitmap output when doing the old-fashioned block query, but that's probably harmless overall.We already know that none of our existing query- interfaces are sane (either too little information, or too much). Duplication starts to push an interface towards too much (it takes processor time to bundle up the extra JSON, especially if the other end is not going to care if it was present). I know Kevin still has somewhere on his to-do list the implementation of a saner query- command for the information we really want (about each block, without redundant information, and where we don't repeat information in a nested manner, but where we also don't omit information that would otherwise require multiple existing query- to reconstruct).
Quoted 5 lines
We can continue to support the output in both places, or we could opt to deprecate the older interface; I think this is one of the last chances we'd get to do so before libvirt and wider adoption.
Quoted 9 lines
Quoted 1 line
I think that's probably Eric's choice.
If you want to try to deprecate the old location, introspection at least works to allow libvirt to know which place to look for it on a given qemu. If you don't think deprecation is necessary, the duplication is probably tolerable for now (as ideally we'd be deprecating ALL of our not-quite-perfect query- block interfaces in favor of whatever sane interface Kevin comes up with).
It sounds like it's probably the right move to deprecate the entire legacy interface, but still... If you have 20 or 30 bitmaps on a root node, you will see 40 or 60 entries.
Quoted 5 lines
What's the smart way to deprecate it? We're not adding new flags or showing new arguments or anything. There might not be bitmaps, so you can't rely on that field being present or absent.
Recommendations?
Kevin's "[PATCH v4 0/6] file-posix: Add dynamic-auto-read-only QAPI feature" adds "feature flags" to the QAPI schema language, limited to struct types, because that's what he needs. They're visible in introspection. I intend to complete his work, so we can tack "deprecated" feature flags to pretty much anything
Could that address your need?
Quoted 7 lines
Quoted 4 lines
Hi Markus, digging this up again.
In brief, we are displaying bitmap info in the "wrong" part of the query result (attached to drive instead of node) and would like to change it.
I lack context: which query command, which part of its result?
query-block (or is it block-query? Well, you know the one.)
It's the optional *dirty-bitmaps field. It's present when there are bitmaps attached to the root of the device.
Quoted 6 lines
Quoted 3 lines
I'd like to avoid reporting bitmaps in both locations permanently, so if we have a plan to deprecate reporting bitmaps in the old location, I will tolerate the duplicated output temporarily.
How bulky is the bitmap report?
@BlockDirtyInfo structure, four bools, a deprecated enum, uint32 and an in.
However, there can be any number of them. Possibly very many. If you have 30 of them on the root node, adding their output to the correct node means you will now see 60 bitmaps reported. (Augh.)
However, see below, if you add them to a node that doesn't qualify for this top-level output, you'll only see them once.
[Incremental backup paradigm: only one per backup chain.
Pull-mode checkpoint paradigm, at least n+1 bitmaps for n checkpoints.]
Quoted 6 lines
Quoted 2 lines
Keeping in mind the bitmap fields are optional (so they can be absent from both the new and old locations), what plan can we implement?
"Optional" is a syntactic thing, which ought to be backed by a semantic "present iff" condition. Have we specified such conditions?
The BlockDirtyInfo is present when there are dirty bitmaps attached to the root node of the "device".
(This special case, bitmaps attached to the "root" of a "device", may or may not work completely correctly with anonymous BlockBackend structures and other non-sugared syntaxes which seemingly create "special" trees that cannot be replicated precisely with QMP commands. I forget the particulars at the present moment.)
Quoted 7 lines
Quoted 3 lines
Perhaps I can add a feature flag "has-node-bitmaps" for 4.2. Then, for the next three versions, I will report bitmaps from both locations. Then, in 5.2+ I will remove the old location.
For how long has the bitmap been in the "wrong" place? Any known consumers?
1. Since it was introduced.
It's just that most of our use cases revolved around bitmaps being attached in this way. With blockdev-backup and more flexible backup modes, we might be creating bitmaps on nodes that aren't traditional drives, and we need to be able to query those. We have no way to do so in 4.1.
So we have had the ability to create mysterious, unqueriable bitmaps for quite some time; since 2.4 at least.
2. Harder to answer. Yes, iotests 124 and 256 and 257 and others look for bitmaps via block-query. These are all the "named" style bitmaps, which I added in 2.4-ish timeframe. They've always been in this weird place.
However, dirty-bitmaps field has existed even before then, and was used for communicating information about the implicit dirty bitmap used by the mirror job. Paolo added that in 1.x, a long long time ago.
21b56835086 (Nov 13 2013) changed this field from "dirty" to "dirty-bitmaps" with no justification for the break in compatibility. The "dirty" field was the one used exclusively for mirror job's dirty information, and this commit and series added support for named bitmaps, and is now used primarily user-created, named bitmap objects. (But it still reports the old, anonymous implicit type for mirror.)
Are there any users for this other kind of bitmap? Completely unknown.
I don't think we use it in iotests, and I don't see evidence of libvirt using it. (I just checked with pkrempa and he doesn't seem to think it's used that way either.)
Quoted 11 lines
Quoted 6 lines
A client knows it can find bitmaps (if there are any) in the new location if the feature flag is set. Otherwise, it should look in the old location.
I think I've convinced myself that this is correct, so correct me if I am wrong.
Sounds like a valid use of feature flags to me. However, feature flags are best used as a last resort. With answers to my questions, I should be able to compare the feature flags solution to possible alternatives.
Quoted 164 lines · John Snow
Quoted 78 lines · Markus Armbruster
Quoted 76 lines · John Snow
Quoted 74 lines · Markus Armbruster
Quoted 58 lines · John Snow
Quoted 43 lines · Eric Blake
Quoted 19 lines · John Snow
Quoted 16 lines · Vladimir Sementsov-Ogievskiy
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.
+++
b/block/qapi.c(quoted diff) +5
-0@@ -78,6 +78,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;Quoted 6 lines
Review BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk, · line 88
Quoted 2 lines
(quoted diff) +0
-0if (blk && blk_get_public(blk)->throttle_group_member.throttle_state) {So query-block uses
bdrv_query_info, which callsbdrv_block_device_info, so we'll duplicate the bitmap output when doing the old-fashioned block query, but that's probably harmless overall.We already know that none of our existing query- interfaces are sane (either too little information, or too much). Duplication starts to push an interface towards too much (it takes processor time to bundle up the extra JSON, especially if the other end is not going to care if it was present). I know Kevin still has somewhere on his to-do list the implementation of a saner query- command for the information we really want (about each block, without redundant information, and where we don't repeat information in a nested manner, but where we also don't omit information that would otherwise require multiple existing query- to reconstruct).
Quoted 5 lines
We can continue to support the output in both places, or we could opt to deprecate the older interface; I think this is one of the last chances we'd get to do so before libvirt and wider adoption.
Quoted 9 lines
Quoted 1 line
I think that's probably Eric's choice.
If you want to try to deprecate the old location, introspection at least works to allow libvirt to know which place to look for it on a given qemu. If you don't think deprecation is necessary, the duplication is probably tolerable for now (as ideally we'd be deprecating ALL of our not-quite-perfect query- block interfaces in favor of whatever sane interface Kevin comes up with).
It sounds like it's probably the right move to deprecate the entire legacy interface, but still... If you have 20 or 30 bitmaps on a root node, you will see 40 or 60 entries.
Quoted 5 lines
What's the smart way to deprecate it? We're not adding new flags or showing new arguments or anything. There might not be bitmaps, so you can't rely on that field being present or absent.
Recommendations?
Kevin's "[PATCH v4 0/6] file-posix: Add dynamic-auto-read-only QAPI feature" adds "feature flags" to the QAPI schema language, limited to struct types, because that's what he needs. They're visible in introspection. I intend to complete his work, so we can tack "deprecated" feature flags to pretty much anything
Could that address your need?
Quoted 7 lines
Quoted 4 lines
Hi Markus, digging this up again.
In brief, we are displaying bitmap info in the "wrong" part of the query result (attached to drive instead of node) and would like to change it.
I lack context: which query command, which part of its result?
query-block (or is it block-query? Well, you know the one.)
It's the optional *dirty-bitmaps field. It's present when there are bitmaps attached to the root of the device.
Quoted 6 lines
Quoted 3 lines
I'd like to avoid reporting bitmaps in both locations permanently, so if we have a plan to deprecate reporting bitmaps in the old location, I will tolerate the duplicated output temporarily.
How bulky is the bitmap report?
@BlockDirtyInfo structure, four bools, a deprecated enum, uint32 and an in.
However, there can be any number of them. Possibly very many. If you have 30 of them on the root node, adding their output to the correct node means you will now see 60 bitmaps reported. (Augh.)
However, see below, if you add them to a node that doesn't qualify for this top-level output, you'll only see them once.
[Incremental backup paradigm: only one per backup chain.
Pull-mode checkpoint paradigm, at least n+1 bitmaps for n checkpoints.]Quoted 6 lines
Quoted 2 lines
Keeping in mind the bitmap fields are optional (so they can be absent from both the new and old locations), what plan can we implement?
"Optional" is a syntactic thing, which ought to be backed by a semantic "present iff" condition. Have we specified such conditions?
The BlockDirtyInfo is present when there are dirty bitmaps attached to the root node of the "device".
(This special case, bitmaps attached to the "root" of a "device", may or may not work completely correctly with anonymous BlockBackend structures and other non-sugared syntaxes which seemingly create "special" trees that cannot be replicated precisely with QMP commands. I forget the particulars at the present moment.)
Quoted 7 lines
Quoted 3 lines
Perhaps I can add a feature flag "has-node-bitmaps" for 4.2. Then, for the next three versions, I will report bitmaps from both locations. Then, in 5.2+ I will remove the old location.
For how long has the bitmap been in the "wrong" place? Any known consumers?
1. Since it was introduced.
It's just that most of our use cases revolved around bitmaps being attached in this way. With blockdev-backup and more flexible backup modes, we might be creating bitmaps on nodes that aren't traditional drives, and we need to be able to query those. We have no way to do so in 4.1.
So we have had the ability to create mysterious, unqueriable bitmaps for quite some time; since 2.4 at least.
2. Harder to answer. Yes, iotests 124 and 256 and 257 and others look for bitmaps via block-query. These are all the "named" style bitmaps, which I added in 2.4-ish timeframe. They've always been in this weird place.
However, dirty-bitmaps field has existed even before then, and was used for communicating information about the implicit dirty bitmap used by the mirror job. Paolo added that in 1.x, a long long time ago.
21b56835086(Nov 13 2013) changed this field from "dirty" to "dirty-bitmaps" with no justification for the break in compatibility. The "dirty" field was the one used exclusively for mirror job's dirty information, and this commit and series added support for named bitmaps, and is now used primarily user-created, named bitmap objects. (But it still reports the old, anonymous implicit type for mirror.)
Quoted 18 lines
Are there any users for this other kind of bitmap? Completely unknown.
I don't think we use it in iotests, and I don't see evidence of libvirt using it. (I just checked with pkrempa and he doesn't seem to think it's used that way either.)
Quoted 11 lines
Quoted 6 lines
A client knows it can find bitmaps (if there are any) in the new location if the feature flag is set. Otherwise, it should look in the old location.
I think I've convinced myself that this is correct, so correct me if I am wrong.
Sounds like a valid use of feature flags to me. However, feature flags are best used as a last resort. With answers to my questions, I should be able to compare the feature flags solution to possible alternatives.
Update: I convinced myself I'm wrong, because even if the *output* isn't always present, it's enough that the field is present via introspection.
So I'll resend my other version of this patch without the feature flag.
--js