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

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