yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

26ba25
From f86061446c280810e39db23ad22c07161837c429 Mon Sep 17 00:00:00 2001
26ba25
From: John Snow <jsnow@redhat.com>
26ba25
Date: Tue, 25 Sep 2018 22:34:29 +0100
26ba25
Subject: [PATCH 26/28] qapi/block-stream: expose new job properties
26ba25
26ba25
RH-Author: John Snow <jsnow@redhat.com>
26ba25
Message-id: <20180925223431.24791-24-jsnow@redhat.com>
26ba25
Patchwork-id: 82278
26ba25
O-Subject: [RHEL8/rhel qemu-kvm PATCH 23/25] qapi/block-stream: expose new job properties
26ba25
Bugzilla: 1632939
26ba25
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
26ba25
RH-Acked-by: Max Reitz <mreitz@redhat.com>
26ba25
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
26ba25
26ba25
Signed-off-by: John Snow <jsnow@redhat.com>
26ba25
Reviewed-by: Max Reitz <mreitz@redhat.com>
26ba25
Message-id: 20180906130225.5118-15-jsnow@redhat.com
26ba25
Reviewed-by: Jeff Cody <jcody@redhat.com>
26ba25
Signed-off-by: Max Reitz <mreitz@redhat.com>
26ba25
(cherry picked from commit 241ca1ab78542f02e666636e0323bcfe3cb1d5e8)
26ba25
Signed-off-by: John Snow <jsnow@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 blockdev.c           |  9 +++++++++
26ba25
 hmp.c                |  5 +++--
26ba25
 qapi/block-core.json | 16 +++++++++++++++-
26ba25
 3 files changed, 27 insertions(+), 3 deletions(-)
26ba25
26ba25
diff --git a/blockdev.c b/blockdev.c
26ba25
index fadafe0..bf026d2 100644
26ba25
--- a/blockdev.c
26ba25
+++ b/blockdev.c
26ba25
@@ -3227,6 +3227,8 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
26ba25
                       bool has_backing_file, const char *backing_file,
26ba25
                       bool has_speed, int64_t speed,
26ba25
                       bool has_on_error, BlockdevOnError on_error,
26ba25
+                      bool has_auto_finalize, bool auto_finalize,
26ba25
+                      bool has_auto_dismiss, bool auto_dismiss,
26ba25
                       Error **errp)
26ba25
 {
26ba25
     BlockDriverState *bs, *iter;
26ba25
@@ -3296,6 +3298,13 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
26ba25
     /* backing_file string overrides base bs filename */
26ba25
     base_name = has_backing_file ? backing_file : base_name;
26ba25
 
26ba25
+    if (has_auto_finalize && !auto_finalize) {
26ba25
+        job_flags |= JOB_MANUAL_FINALIZE;
26ba25
+    }
26ba25
+    if (has_auto_dismiss && !auto_dismiss) {
26ba25
+        job_flags |= JOB_MANUAL_DISMISS;
26ba25
+    }
26ba25
+
26ba25
     stream_start(has_job_id ? job_id : NULL, bs, base_bs, base_name,
26ba25
                  job_flags, has_speed ? speed : 0, on_error, &local_err);
26ba25
     if (local_err) {
26ba25
diff --git a/hmp.c b/hmp.c
26ba25
index a25c7bd..fefec87 100644
26ba25
--- a/hmp.c
26ba25
+++ b/hmp.c
26ba25
@@ -1797,8 +1797,9 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict)
26ba25
     int64_t speed = qdict_get_try_int(qdict, "speed", 0);
26ba25
 
26ba25
     qmp_block_stream(true, device, device, base != NULL, base, false, NULL,
26ba25
-                     false, NULL, qdict_haskey(qdict, "speed"), speed,
26ba25
-                     true, BLOCKDEV_ON_ERROR_REPORT, &error);
26ba25
+                     false, NULL, qdict_haskey(qdict, "speed"), speed, true,
26ba25
+                     BLOCKDEV_ON_ERROR_REPORT, false, false, false, false,
26ba25
+                     &error);
26ba25
 
26ba25
     hmp_handle_error(mon, &error);
26ba25
 }
26ba25
diff --git a/qapi/block-core.json b/qapi/block-core.json
26ba25
index 3f9ff18..ba4bba0 100644
26ba25
--- a/qapi/block-core.json
26ba25
+++ b/qapi/block-core.json
26ba25
@@ -2290,6 +2290,19 @@
26ba25
 #            'stop' and 'enospc' can only be used if the block device
26ba25
 #            supports io-status (see BlockInfo).  Since 1.3.
26ba25
 #
26ba25
+# @auto-finalize: When false, this job will wait in a PENDING state after it has
26ba25
+#                 finished its work, waiting for @block-job-finalize before
26ba25
+#                 making any block graph changes.
26ba25
+#                 When true, this job will automatically
26ba25
+#                 perform its abort or commit actions.
26ba25
+#                 Defaults to true. (Since 3.1)
26ba25
+#
26ba25
+# @auto-dismiss: When false, this job will wait in a CONCLUDED state after it
26ba25
+#                has completely ceased all work, and awaits @block-job-dismiss.
26ba25
+#                When true, this job will automatically disappear from the query
26ba25
+#                list without user intervention.
26ba25
+#                Defaults to true. (Since 3.1)
26ba25
+#
26ba25
 # Returns: Nothing on success. If @device does not exist, DeviceNotFound.
26ba25
 #
26ba25
 # Since: 1.1
26ba25
@@ -2305,7 +2318,8 @@
26ba25
 { 'command': 'block-stream',
26ba25
   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
26ba25
             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
26ba25
-            '*on-error': 'BlockdevOnError' } }
26ba25
+            '*on-error': 'BlockdevOnError',
26ba25
+            '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
26ba25
 
26ba25
 ##
26ba25
 # @block-job-set-speed:
26ba25
-- 
26ba25
1.8.3.1
26ba25