thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

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