thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
ae23c9
From f86061446c280810e39db23ad22c07161837c429 Mon Sep 17 00:00:00 2001
ae23c9
From: John Snow <jsnow@redhat.com>
ae23c9
Date: Tue, 25 Sep 2018 22:34:29 +0100
ae23c9
Subject: [PATCH 26/28] qapi/block-stream: expose new job properties
ae23c9
ae23c9
RH-Author: John Snow <jsnow@redhat.com>
ae23c9
Message-id: <20180925223431.24791-24-jsnow@redhat.com>
ae23c9
Patchwork-id: 82278
ae23c9
O-Subject: [RHEL8/rhel qemu-kvm PATCH 23/25] qapi/block-stream: 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-15-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 241ca1ab78542f02e666636e0323bcfe3cb1d5e8)
ae23c9
Signed-off-by: John Snow <jsnow@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 blockdev.c           |  9 +++++++++
ae23c9
 hmp.c                |  5 +++--
ae23c9
 qapi/block-core.json | 16 +++++++++++++++-
ae23c9
 3 files changed, 27 insertions(+), 3 deletions(-)
ae23c9
ae23c9
diff --git a/blockdev.c b/blockdev.c
ae23c9
index fadafe0..bf026d2 100644
ae23c9
--- a/blockdev.c
ae23c9
+++ b/blockdev.c
ae23c9
@@ -3227,6 +3227,8 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
ae23c9
                       bool has_backing_file, const char *backing_file,
ae23c9
                       bool has_speed, int64_t speed,
ae23c9
                       bool has_on_error, BlockdevOnError on_error,
ae23c9
+                      bool has_auto_finalize, bool auto_finalize,
ae23c9
+                      bool has_auto_dismiss, bool auto_dismiss,
ae23c9
                       Error **errp)
ae23c9
 {
ae23c9
     BlockDriverState *bs, *iter;
ae23c9
@@ -3296,6 +3298,13 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
ae23c9
     /* backing_file string overrides base bs filename */
ae23c9
     base_name = has_backing_file ? backing_file : base_name;
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
     stream_start(has_job_id ? job_id : NULL, bs, base_bs, base_name,
ae23c9
                  job_flags, has_speed ? speed : 0, on_error, &local_err);
ae23c9
     if (local_err) {
ae23c9
diff --git a/hmp.c b/hmp.c
ae23c9
index a25c7bd..fefec87 100644
ae23c9
--- a/hmp.c
ae23c9
+++ b/hmp.c
ae23c9
@@ -1797,8 +1797,9 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict)
ae23c9
     int64_t speed = qdict_get_try_int(qdict, "speed", 0);
ae23c9
 
ae23c9
     qmp_block_stream(true, device, device, base != NULL, base, false, NULL,
ae23c9
-                     false, NULL, qdict_haskey(qdict, "speed"), speed,
ae23c9
-                     true, BLOCKDEV_ON_ERROR_REPORT, &error);
ae23c9
+                     false, NULL, qdict_haskey(qdict, "speed"), speed, true,
ae23c9
+                     BLOCKDEV_ON_ERROR_REPORT, false, false, false, false,
ae23c9
+                     &error);
ae23c9
 
ae23c9
     hmp_handle_error(mon, &error);
ae23c9
 }
ae23c9
diff --git a/qapi/block-core.json b/qapi/block-core.json
ae23c9
index 3f9ff18..ba4bba0 100644
ae23c9
--- a/qapi/block-core.json
ae23c9
+++ b/qapi/block-core.json
ae23c9
@@ -2290,6 +2290,19 @@
ae23c9
 #            'stop' and 'enospc' can only be used if the block device
ae23c9
 #            supports io-status (see BlockInfo).  Since 1.3.
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
+#
ae23c9
 # Returns: Nothing on success. If @device does not exist, DeviceNotFound.
ae23c9
 #
ae23c9
 # Since: 1.1
ae23c9
@@ -2305,7 +2318,8 @@
ae23c9
 { 'command': 'block-stream',
ae23c9
   'data': { '*job-id': 'str', 'device': 'str', '*base': 'str',
ae23c9
             '*base-node': 'str', '*backing-file': 'str', '*speed': 'int',
ae23c9
-            '*on-error': 'BlockdevOnError' } }
ae23c9
+            '*on-error': 'BlockdevOnError',
ae23c9
+            '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } }
ae23c9
 
ae23c9
 ##
ae23c9
 # @block-job-set-speed:
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9