On 02/11/2015 02:10 PM, Max Reitz wrote:
On 2015-02-09 at 20:35, John Snow wrote:
Adds the "disabled" and "frozen" status booleans.

Signed-off-by: Fam Zheng <f...@redhat.com>
Signed-off-by: John Snow <js...@redhat.com>
---
  block.c              | 2 ++
  qapi/block-core.json | 7 ++++++-
  2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/block.c b/block.c
index ad33d96..3c0989c 100644
--- a/block.c
+++ b/block.c
@@ -5564,6 +5564,8 @@ BlockDirtyInfoList
*bdrv_query_dirty_bitmaps(BlockDriverState *bs)
          info->granularity = bdrv_dirty_bitmap_granularity(bm);
          info->has_name = !!bm->name;
          info->name = g_strdup(bm->name);
+        info->disabled = bm->disabled;

Hm, this is different than !bdrv_dirty_bitmap_enabled(), but I can
understand the reasoning if the difference is intended.

Therefore, as long as it's intended:

Reviewed-by: Max Reitz <mre...@redhat.com>


Yes, since I am exposing the frozen condition as well, so that error messages aren't opaque: "Something is busy, sorry, go away." At least with this you can check what conditions are preventing operations from completing.

info->disabled was meant to expose only the user-controlled "on/off" states.

+        info->frozen = bdrv_dirty_bitmap_frozen(bm);
          entry->value = info;
          *plist = entry;
          plist = &entry->next;
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 702b76a..c5d5563 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -332,10 +332,15 @@
  #
  # @granularity: granularity of the dirty bitmap in bytes (since 1.4)
  #
+# @disabled: whether the dirty bitmap is disabled (Since 2.3)
+#
+# @frozen: whether the dirty bitmap is frozen (Since 2.3)
+#
  # Since: 1.3
  ##
  { 'type': 'BlockDirtyInfo',
-  'data': {'*name': 'str', 'count': 'int', 'granularity': 'int'} }
+  'data': {'*name': 'str', 'count': 'int', 'granularity': 'int',
+           'disabled': 'bool', 'frozen': 'bool'} }
  ##
  # @BlockInfo:


--
—js

Reply via email to