cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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