yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-qapi-block-mirror-expose-new-job-properties.patch

ae23c9
From 47eda5e717db143f5135e00f5bd6a478f613c28d Mon Sep 17 00:00:00 2001
ae23c9
From: John Snow <jsnow@redhat.com>
ae23c9
Date: Tue, 25 Sep 2018 22:34:28 +0100
ae23c9
Subject: [PATCH 25/28] qapi/block-mirror: expose new job properties
ae23c9
ae23c9
RH-Author: John Snow <jsnow@redhat.com>
ae23c9
Message-id: <20180925223431.24791-23-jsnow@redhat.com>
ae23c9
Patchwork-id: 82274
ae23c9
O-Subject: [RHEL8/rhel qemu-kvm PATCH 22/25] qapi/block-mirror: expose new job properties
ae23c9
Bugzilla: 1632939
ae23c9
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
ae23c9
RH-Acked-by: Max Reitz <mreitz@redhat.com>
ae23c9
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
ae23c9
Signed-off-by: John Snow <jsnow@redhat.com>
ae23c9
Reviewed-by: Max Reitz <mreitz@redhat.com>
ae23c9
Message-id: 20180906130225.5118-14-jsnow@redhat.com
ae23c9
Reviewed-by: Jeff Cody <jcody@redhat.com>
ae23c9
Signed-off-by: Max Reitz <mreitz@redhat.com>
ae23c9
(cherry picked from commit a6b58adec28ff43c0f29ff7c95cdd5d11e87cf61)
ae23c9
Signed-off-by: John Snow <jsnow@redhat.com>
ae23c9
ae23c9
Conflicts: downstream does not have has_copy_mode.
ae23c9
    -blockdev.c
ae23c9
    -qapi/block-core.json
ae23c9
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 blockdev.c           | 14 ++++++++++++++
ae23c9
 qapi/block-core.json | 30 ++++++++++++++++++++++++++++--
ae23c9
 2 files changed, 42 insertions(+), 2 deletions(-)
ae23c9
ae23c9
diff --git a/blockdev.c b/blockdev.c
ae23c9
index 10b5944..fadafe0 100644
ae23c9
--- a/blockdev.c
ae23c9
+++ b/blockdev.c
ae23c9
@@ -3707,6 +3707,8 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
ae23c9
                                    bool has_unmap, bool unmap,
ae23c9
                                    bool has_filter_node_name,
ae23c9
                                    const char *filter_node_name,
ae23c9
+                                   bool has_auto_finalize, bool auto_finalize,
ae23c9
+                                   bool has_auto_dismiss, bool auto_dismiss,
ae23c9
                                    Error **errp)
ae23c9
 {
ae23c9
     int job_flags = JOB_DEFAULT;
ae23c9
@@ -3732,6 +3734,12 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
ae23c9
     if (!has_filter_node_name) {
ae23c9
         filter_node_name = NULL;
ae23c9
     }
ae23c9
+    if (has_auto_finalize && !auto_finalize) {
ae23c9
+        job_flags |= JOB_MANUAL_FINALIZE;
ae23c9
+    }
ae23c9
+    if (has_auto_dismiss && !auto_dismiss) {
ae23c9
+        job_flags |= JOB_MANUAL_DISMISS;
ae23c9
+    }
ae23c9
 
ae23c9
     if (granularity != 0 && (granularity < 512 || granularity > 1048576 * 64)) {
ae23c9
         error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
ae23c9
@@ -3908,6 +3916,8 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)
ae23c9
                            arg->has_on_target_error, arg->on_target_error,
ae23c9
                            arg->has_unmap, arg->unmap,
ae23c9
                            false, NULL,
ae23c9
+                           arg->has_auto_finalize, arg->auto_finalize,
ae23c9
+                           arg->has_auto_dismiss, arg->auto_dismiss,
ae23c9
                            &local_err);
ae23c9
     bdrv_unref(target_bs);
ae23c9
     error_propagate(errp, local_err);
ae23c9
@@ -3928,6 +3938,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
ae23c9
                          BlockdevOnError on_target_error,
ae23c9
                          bool has_filter_node_name,
ae23c9
                          const char *filter_node_name,
ae23c9
+                         bool has_auto_finalize, bool auto_finalize,
ae23c9
+                         bool has_auto_dismiss, bool auto_dismiss,
ae23c9
                          Error **errp)
ae23c9
 {
ae23c9
     BlockDriverState *bs;
ae23c9
@@ -3960,6 +3972,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,
ae23c9
                            has_on_target_error, on_target_error,
ae23c9
                            true, true,
ae23c9
                            has_filter_node_name, filter_node_name,
ae23c9
+                           has_auto_finalize, auto_finalize,
ae23c9
+                           has_auto_dismiss, auto_dismiss,
ae23c9
                            &local_err);
ae23c9
     error_propagate(errp, local_err);
ae23c9
 
ae23c9
diff --git a/qapi/block-core.json b/qapi/block-core.json
ae23c9
index c29c4b6..3f9ff18 100644
ae23c9
--- a/qapi/block-core.json
ae23c9
+++ b/qapi/block-core.json
ae23c9
@@ -1706,6 +1706,18 @@
ae23c9
 #         written. Both will result in identical contents.
ae23c9
 #         Default is true. (Since 2.4)
ae23c9
 #
ae23c9
+# @auto-finalize: When false, this job will wait in a PENDING state after it has
ae23c9
+#                 finished its work, waiting for @block-job-finalize before
ae23c9
+#                 making any block graph changes.
ae23c9
+#                 When true, this job will automatically
ae23c9
+#                 perform its abort or commit actions.
ae23c9
+#                 Defaults to true. (Since 3.1)
ae23c9
+#
ae23c9
+# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
ae23c9
+#                has completely ceased all work, and awaits @block-job-dismiss.
ae23c9
+#                When true, this job will automatically disappear from the query
ae23c9
+#                list without user intervention.
ae23c9
+#                Defaults to true. (Since 3.1)
ae23c9
 # Since: 1.3
ae23c9
 ##
ae23c9
 { 'struct': 'DriveMirror',
ae23c9
@@ -1715,7 +1727,8 @@
ae23c9
             '*speed': 'int', '*granularity': 'uint32',
ae23c9
             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
ae23c9
             '*on-target-error': 'BlockdevOnError',
ae23c9
-            '*unmap': 'bool' } }
ae23c9
+            '*unmap': 'bool',
ae23c9
+            '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
ae23c9
 
ae23c9
 ##
ae23c9
 # @BlockDirtyBitmap:
ae23c9
@@ -1978,6 +1991,18 @@
ae23c9
 #                    above @device. If this option is not given, a node name is
ae23c9
 #                    autogenerated. (Since: 2.9)
ae23c9
 #
ae23c9
+# @auto-finalize: When false, this job will wait in a PENDING state after it has
ae23c9
+#                 finished its work, waiting for @block-job-finalize before
ae23c9
+#                 making any block graph changes.
ae23c9
+#                 When true, this job will automatically
ae23c9
+#                 perform its abort or commit actions.
ae23c9
+#                 Defaults to true. (Since 3.1)
ae23c9
+#
ae23c9
+# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
ae23c9
+#                has completely ceased all work, and awaits @block-job-dismiss.
ae23c9
+#                When true, this job will automatically disappear from the query
ae23c9
+#                list without user intervention.
ae23c9
+#                Defaults to true. (Since 3.1)
ae23c9
 # Returns: nothing on success.
ae23c9
 #
ae23c9
 # Since: 2.6
ae23c9
@@ -1998,7 +2023,8 @@
ae23c9
             '*speed': 'int', '*granularity': 'uint32',
ae23c9
             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
ae23c9
             '*on-target-error': 'BlockdevOnError',
ae23c9
-            '*filter-node-name': 'str' } }
ae23c9
+            '*filter-node-name': 'str',
ae23c9
+            '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
ae23c9
 
ae23c9
 ##
ae23c9
 # @block_set_io_throttle:
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9