Blame SOURCES/kvm-qapi-add-disabled-parameter-to-block-dirty-bitmap-ad.patch

357786
From ecbd9793ceb09c1dbbe2e37fd132aa428eb2b4fb Mon Sep 17 00:00:00 2001
357786
From: John Snow <jsnow@redhat.com>
357786
Date: Wed, 18 Jul 2018 22:54:41 +0200
357786
Subject: [PATCH 56/89] qapi: add disabled parameter to block-dirty-bitmap-add
357786
357786
RH-Author: John Snow <jsnow@redhat.com>
357786
Message-id: <20180718225511.14878-6-jsnow@redhat.com>
357786
Patchwork-id: 81404
357786
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 05/35] qapi: add disabled parameter to block-dirty-bitmap-add
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
This is needed, for example, to create a new bitmap and merge several
357786
disabled bitmaps into a new one. Without this flag we will have to
357786
put block-dirty-bitmap-add and block-dirty-bitmap-disable into one
357786
transaction.
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-6-jsnow@redhat.com
357786
Signed-off-by: John Snow <jsnow@redhat.com>
357786
(cherry picked from commit a6e2ca5f6521553681ae136578ec1cb67e1a7973)
357786
Signed-off-by: John Snow <jsnow@redhat.com>
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 blockdev.c           | 10 ++++++++++
357786
 qapi/block-core.json |  6 +++++-
357786
 2 files changed, 15 insertions(+), 1 deletion(-)
357786
357786
diff --git a/blockdev.c b/blockdev.c
357786
index 3728082..9beef10 100644
357786
--- a/blockdev.c
357786
+++ b/blockdev.c
357786
@@ -2115,6 +2115,7 @@ static void block_dirty_bitmap_add_prepare(BlkActionState *common,
357786
                                action->has_granularity, action->granularity,
357786
                                action->has_persistent, action->persistent,
357786
                                action->has_autoload, action->autoload,
357786
+                               action->has_x_disabled, action->x_disabled,
357786
                                &local_err);
357786
 
357786
     if (!local_err) {
357786
@@ -2922,6 +2923,7 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
357786
                                 bool has_granularity, uint32_t granularity,
357786
                                 bool has_persistent, bool persistent,
357786
                                 bool has_autoload, bool autoload,
357786
+                                bool has_disabled, bool disabled,
357786
                                 Error **errp)
357786
 {
357786
     BlockDriverState *bs;
357786
@@ -2956,6 +2958,10 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
357786
         warn_report("Autoload option is deprecated and its value is ignored");
357786
     }
357786
 
357786
+    if (!has_disabled) {
357786
+        disabled = false;
357786
+    }
357786
+
357786
     if (persistent &&
357786
         !bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp))
357786
     {
357786
@@ -2967,6 +2973,10 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name,
357786
         return;
357786
     }
357786
 
357786
+    if (disabled) {
357786
+        bdrv_disable_dirty_bitmap(bitmap);
357786
+    }
357786
+
357786
     bdrv_dirty_bitmap_set_persistance(bitmap, persistent);
357786
 }
357786
 
357786
diff --git a/qapi/block-core.json b/qapi/block-core.json
357786
index 4e1fda3..27ed91b 100644
357786
--- a/qapi/block-core.json
357786
+++ b/qapi/block-core.json
357786
@@ -1734,11 +1734,15 @@
357786
 #            Currently, all dirty tracking bitmaps are loaded from Qcow2 on
357786
 #            open.
357786
 #
357786
+# @x-disabled: the bitmap is created in the disabled state, which means that
357786
+#              it will not track drive changes. The bitmap may be enabled with
357786
+#              x-block-dirty-bitmap-enable. Default is false. (Since: 3.0)
357786
+#
357786
 # Since: 2.4
357786
 ##
357786
 { 'struct': 'BlockDirtyBitmapAdd',
357786
   'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32',
357786
-            '*persistent': 'bool', '*autoload': 'bool' } }
357786
+            '*persistent': 'bool', '*autoload': 'bool', '*x-disabled': 'bool' } }
357786
 
357786
 ##
357786
 # @BlockDirtyBitmapMerge:
357786
-- 
357786
1.8.3.1
357786