ae23c9
From 379a26a4794704679a8df09fdf046f60f0abea3b Mon Sep 17 00:00:00 2001
ae23c9
From: Kevin Wolf <kwolf@redhat.com>
ae23c9
Date: Tue, 26 Jun 2018 09:48:30 +0200
ae23c9
Subject: [PATCH 122/268] job: Introduce qapi/job.json
ae23c9
ae23c9
RH-Author: Kevin Wolf <kwolf@redhat.com>
ae23c9
Message-id: <20180626094856.6924-48-kwolf@redhat.com>
ae23c9
Patchwork-id: 81099
ae23c9
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 47/73] job: Introduce qapi/job.json
ae23c9
Bugzilla: 1513543
ae23c9
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
ae23c9
RH-Acked-by: Max Reitz <mreitz@redhat.com>
ae23c9
RH-Acked-by: Fam Zheng <famz@redhat.com>
ae23c9
ae23c9
This adds a separate schema file for all job-related definitions that
ae23c9
aren't tied to the block layer.
ae23c9
ae23c9
For a start, move the enums JobType, JobStatus and JobVerb.
ae23c9
ae23c9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
Reviewed-by: Eric Blake <eblake@redhat.com>
ae23c9
(cherry picked from commit bf42508f24ee1368267b421e145fa90315b77936)
ae23c9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
ae23c9
---
ae23c9
 MAINTAINERS           |  1 +
ae23c9
 Makefile              |  9 +++++
ae23c9
 Makefile.objs         |  4 +++
ae23c9
 qapi/block-core.json  | 90 +-----------------------------------------------
ae23c9
 qapi/job.json         | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++
ae23c9
 qapi/qapi-schema.json |  1 +
ae23c9
 6 files changed, 110 insertions(+), 89 deletions(-)
ae23c9
 create mode 100644 qapi/job.json
ae23c9
ae23c9
diff --git a/MAINTAINERS b/MAINTAINERS
ae23c9
index c5e3dfb..5aaf264 100644
ae23c9
--- a/MAINTAINERS
ae23c9
+++ b/MAINTAINERS
ae23c9
@@ -1377,6 +1377,7 @@ F: block/backup.c
ae23c9
 F: block/commit.c
ae23c9
 F: block/stream.c
ae23c9
 F: block/mirror.c
ae23c9
+F: qapi/job.json
ae23c9
 T: git git://github.com/codyprime/qemu-kvm-jtc.git block
ae23c9
 
ae23c9
 Block QAPI, monitor, command line
ae23c9
diff --git a/Makefile b/Makefile
ae23c9
index d0a848e..9803f27 100644
ae23c9
--- a/Makefile
ae23c9
+++ b/Makefile
ae23c9
@@ -98,6 +98,7 @@ GENERATED_FILES += qapi/qapi-types-char.h qapi/qapi-types-char.c
ae23c9
 GENERATED_FILES += qapi/qapi-types-common.h qapi/qapi-types-common.c
ae23c9
 GENERATED_FILES += qapi/qapi-types-crypto.h qapi/qapi-types-crypto.c
ae23c9
 GENERATED_FILES += qapi/qapi-types-introspect.h qapi/qapi-types-introspect.c
ae23c9
+GENERATED_FILES += qapi/qapi-types-job.h qapi/qapi-types-job.c
ae23c9
 GENERATED_FILES += qapi/qapi-types-migration.h qapi/qapi-types-migration.c
ae23c9
 GENERATED_FILES += qapi/qapi-types-misc.h qapi/qapi-types-misc.c
ae23c9
 GENERATED_FILES += qapi/qapi-types-net.h qapi/qapi-types-net.c
ae23c9
@@ -116,6 +117,7 @@ GENERATED_FILES += qapi/qapi-visit-char.h qapi/qapi-visit-char.c
ae23c9
 GENERATED_FILES += qapi/qapi-visit-common.h qapi/qapi-visit-common.c
ae23c9
 GENERATED_FILES += qapi/qapi-visit-crypto.h qapi/qapi-visit-crypto.c
ae23c9
 GENERATED_FILES += qapi/qapi-visit-introspect.h qapi/qapi-visit-introspect.c
ae23c9
+GENERATED_FILES += qapi/qapi-visit-job.h qapi/qapi-visit-job.c
ae23c9
 GENERATED_FILES += qapi/qapi-visit-migration.h qapi/qapi-visit-migration.c
ae23c9
 GENERATED_FILES += qapi/qapi-visit-misc.h qapi/qapi-visit-misc.c
ae23c9
 GENERATED_FILES += qapi/qapi-visit-net.h qapi/qapi-visit-net.c
ae23c9
@@ -133,6 +135,7 @@ GENERATED_FILES += qapi/qapi-commands-char.h qapi/qapi-commands-char.c
ae23c9
 GENERATED_FILES += qapi/qapi-commands-common.h qapi/qapi-commands-common.c
ae23c9
 GENERATED_FILES += qapi/qapi-commands-crypto.h qapi/qapi-commands-crypto.c
ae23c9
 GENERATED_FILES += qapi/qapi-commands-introspect.h qapi/qapi-commands-introspect.c
ae23c9
+GENERATED_FILES += qapi/qapi-commands-job.h qapi/qapi-commands-job.c
ae23c9
 GENERATED_FILES += qapi/qapi-commands-migration.h qapi/qapi-commands-migration.c
ae23c9
 GENERATED_FILES += qapi/qapi-commands-misc.h qapi/qapi-commands-misc.c
ae23c9
 GENERATED_FILES += qapi/qapi-commands-net.h qapi/qapi-commands-net.c
ae23c9
@@ -150,6 +153,7 @@ GENERATED_FILES += qapi/qapi-events-char.h qapi/qapi-events-char.c
ae23c9
 GENERATED_FILES += qapi/qapi-events-common.h qapi/qapi-events-common.c
ae23c9
 GENERATED_FILES += qapi/qapi-events-crypto.h qapi/qapi-events-crypto.c
ae23c9
 GENERATED_FILES += qapi/qapi-events-introspect.h qapi/qapi-events-introspect.c
ae23c9
+GENERATED_FILES += qapi/qapi-events-job.h qapi/qapi-events-job.c
ae23c9
 GENERATED_FILES += qapi/qapi-events-migration.h qapi/qapi-events-migration.c
ae23c9
 GENERATED_FILES += qapi/qapi-events-misc.h qapi/qapi-events-misc.c
ae23c9
 GENERATED_FILES += qapi/qapi-events-net.h qapi/qapi-events-net.c
ae23c9
@@ -582,6 +586,7 @@ qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json $(SRC_PATH)/qapi/common.json \
ae23c9
                $(SRC_PATH)/qapi/char.json \
ae23c9
                $(SRC_PATH)/qapi/crypto.json \
ae23c9
                $(SRC_PATH)/qapi/introspect.json \
ae23c9
+               $(SRC_PATH)/qapi/job.json \
ae23c9
                $(SRC_PATH)/qapi/migration.json \
ae23c9
                $(SRC_PATH)/qapi/misc.json \
ae23c9
                $(SRC_PATH)/qapi/net.json \
ae23c9
@@ -601,6 +606,7 @@ qapi/qapi-types-char.c qapi/qapi-types-char.h \
ae23c9
 qapi/qapi-types-common.c qapi/qapi-types-common.h \
ae23c9
 qapi/qapi-types-crypto.c qapi/qapi-types-crypto.h \
ae23c9
 qapi/qapi-types-introspect.c qapi/qapi-types-introspect.h \
ae23c9
+qapi/qapi-types-job.c qapi/qapi-types-job.h \
ae23c9
 qapi/qapi-types-migration.c qapi/qapi-types-migration.h \
ae23c9
 qapi/qapi-types-misc.c qapi/qapi-types-misc.h \
ae23c9
 qapi/qapi-types-net.c qapi/qapi-types-net.h \
ae23c9
@@ -619,6 +625,7 @@ qapi/qapi-visit-char.c qapi/qapi-visit-char.h \
ae23c9
 qapi/qapi-visit-common.c qapi/qapi-visit-common.h \
ae23c9
 qapi/qapi-visit-crypto.c qapi/qapi-visit-crypto.h \
ae23c9
 qapi/qapi-visit-introspect.c qapi/qapi-visit-introspect.h \
ae23c9
+qapi/qapi-visit-job.c qapi/qapi-visit-job.h \
ae23c9
 qapi/qapi-visit-migration.c qapi/qapi-visit-migration.h \
ae23c9
 qapi/qapi-visit-misc.c qapi/qapi-visit-misc.h \
ae23c9
 qapi/qapi-visit-net.c qapi/qapi-visit-net.h \
ae23c9
@@ -636,6 +643,7 @@ qapi/qapi-commands-char.c qapi/qapi-commands-char.h \
ae23c9
 qapi/qapi-commands-common.c qapi/qapi-commands-common.h \
ae23c9
 qapi/qapi-commands-crypto.c qapi/qapi-commands-crypto.h \
ae23c9
 qapi/qapi-commands-introspect.c qapi/qapi-commands-introspect.h \
ae23c9
+qapi/qapi-commands-job.c qapi/qapi-commands-job.h \
ae23c9
 qapi/qapi-commands-migration.c qapi/qapi-commands-migration.h \
ae23c9
 qapi/qapi-commands-misc.c qapi/qapi-commands-misc.h \
ae23c9
 qapi/qapi-commands-net.c qapi/qapi-commands-net.h \
ae23c9
@@ -653,6 +661,7 @@ qapi/qapi-events-char.c qapi/qapi-events-char.h \
ae23c9
 qapi/qapi-events-common.c qapi/qapi-events-common.h \
ae23c9
 qapi/qapi-events-crypto.c qapi/qapi-events-crypto.h \
ae23c9
 qapi/qapi-events-introspect.c qapi/qapi-events-introspect.h \
ae23c9
+qapi/qapi-events-job.c qapi/qapi-events-job.h \
ae23c9
 qapi/qapi-events-migration.c qapi/qapi-events-migration.h \
ae23c9
 qapi/qapi-events-misc.c qapi/qapi-events-misc.h \
ae23c9
 qapi/qapi-events-net.c qapi/qapi-events-net.h \
ae23c9
diff --git a/Makefile.objs b/Makefile.objs
ae23c9
index 92b73fc..3df8d58 100644
ae23c9
--- a/Makefile.objs
ae23c9
+++ b/Makefile.objs
ae23c9
@@ -10,6 +10,7 @@ util-obj-y += qapi/qapi-types-char.o
ae23c9
 util-obj-y += qapi/qapi-types-common.o
ae23c9
 util-obj-y += qapi/qapi-types-crypto.o
ae23c9
 util-obj-y += qapi/qapi-types-introspect.o
ae23c9
+util-obj-y += qapi/qapi-types-job.o
ae23c9
 util-obj-y += qapi/qapi-types-migration.o
ae23c9
 util-obj-y += qapi/qapi-types-misc.o
ae23c9
 util-obj-y += qapi/qapi-types-net.o
ae23c9
@@ -28,6 +29,7 @@ util-obj-y += qapi/qapi-visit-char.o
ae23c9
 util-obj-y += qapi/qapi-visit-common.o
ae23c9
 util-obj-y += qapi/qapi-visit-crypto.o
ae23c9
 util-obj-y += qapi/qapi-visit-introspect.o
ae23c9
+util-obj-y += qapi/qapi-visit-job.o
ae23c9
 util-obj-y += qapi/qapi-visit-migration.o
ae23c9
 util-obj-y += qapi/qapi-visit-misc.o
ae23c9
 util-obj-y += qapi/qapi-visit-net.o
ae23c9
@@ -45,6 +47,7 @@ util-obj-y += qapi/qapi-events-char.o
ae23c9
 util-obj-y += qapi/qapi-events-common.o
ae23c9
 util-obj-y += qapi/qapi-events-crypto.o
ae23c9
 util-obj-y += qapi/qapi-events-introspect.o
ae23c9
+util-obj-y += qapi/qapi-events-job.o
ae23c9
 util-obj-y += qapi/qapi-events-migration.o
ae23c9
 util-obj-y += qapi/qapi-events-misc.o
ae23c9
 util-obj-y += qapi/qapi-events-net.o
ae23c9
@@ -140,6 +143,7 @@ common-obj-y += qapi/qapi-commands-char.o
ae23c9
 common-obj-y += qapi/qapi-commands-common.o
ae23c9
 common-obj-y += qapi/qapi-commands-crypto.o
ae23c9
 common-obj-y += qapi/qapi-commands-introspect.o
ae23c9
+common-obj-y += qapi/qapi-commands-job.o
ae23c9
 common-obj-y += qapi/qapi-commands-migration.o
ae23c9
 common-obj-y += qapi/qapi-commands-misc.o
ae23c9
 common-obj-y += qapi/qapi-commands-net.o
ae23c9
diff --git a/qapi/block-core.json b/qapi/block-core.json
ae23c9
index f2ed7a8..96ddf87 100644
ae23c9
--- a/qapi/block-core.json
ae23c9
+++ b/qapi/block-core.json
ae23c9
@@ -6,6 +6,7 @@
ae23c9
 
ae23c9
 { 'include': 'common.json' }
ae23c9
 { 'include': 'crypto.json' }
ae23c9
+{ 'include': 'job.json' }
ae23c9
 { 'include': 'sockets.json' }
ae23c9
 
ae23c9
 ##
ae23c9
@@ -1050,95 +1051,6 @@
ae23c9
   'data': ['top', 'full', 'none', 'incremental'] }
ae23c9
 
ae23c9
 ##
ae23c9
-# @JobType:
ae23c9
-#
ae23c9
-# Type of a background job.
ae23c9
-#
ae23c9
-# @commit: block commit job type, see "block-commit"
ae23c9
-#
ae23c9
-# @stream: block stream job type, see "block-stream"
ae23c9
-#
ae23c9
-# @mirror: drive mirror job type, see "drive-mirror"
ae23c9
-#
ae23c9
-# @backup: drive backup job type, see "drive-backup"
ae23c9
-#
ae23c9
-# Since: 1.7
ae23c9
-##
ae23c9
-{ 'enum': 'JobType',
ae23c9
-  'data': ['commit', 'stream', 'mirror', 'backup'] }
ae23c9
-
ae23c9
-##
ae23c9
-# @JobVerb:
ae23c9
-#
ae23c9
-# Represents command verbs that can be applied to a job.
ae23c9
-#
ae23c9
-# @cancel: see @block-job-cancel
ae23c9
-#
ae23c9
-# @pause: see @block-job-pause
ae23c9
-#
ae23c9
-# @resume: see @block-job-resume
ae23c9
-#
ae23c9
-# @set-speed: see @block-job-set-speed
ae23c9
-#
ae23c9
-# @complete: see @block-job-complete
ae23c9
-#
ae23c9
-# @dismiss: see @block-job-dismiss
ae23c9
-#
ae23c9
-# @finalize: see @block-job-finalize
ae23c9
-#
ae23c9
-# Since: 2.12
ae23c9
-##
ae23c9
-{ 'enum': 'JobVerb',
ae23c9
-  'data': ['cancel', 'pause', 'resume', 'set-speed', 'complete', 'dismiss',
ae23c9
-           'finalize' ] }
ae23c9
-
ae23c9
-##
ae23c9
-# @JobStatus:
ae23c9
-#
ae23c9
-# Indicates the present state of a given job in its lifetime.
ae23c9
-#
ae23c9
-# @undefined: Erroneous, default state. Should not ever be visible.
ae23c9
-#
ae23c9
-# @created: The job has been created, but not yet started.
ae23c9
-#
ae23c9
-# @running: The job is currently running.
ae23c9
-#
ae23c9
-# @paused: The job is running, but paused. The pause may be requested by
ae23c9
-#          either the QMP user or by internal processes.
ae23c9
-#
ae23c9
-# @ready: The job is running, but is ready for the user to signal completion.
ae23c9
-#         This is used for long-running jobs like mirror that are designed to
ae23c9
-#         run indefinitely.
ae23c9
-#
ae23c9
-# @standby: The job is ready, but paused. This is nearly identical to @paused.
ae23c9
-#           The job may return to @ready or otherwise be canceled.
ae23c9
-#
ae23c9
-# @waiting: The job is waiting for other jobs in the transaction to converge
ae23c9
-#           to the waiting state. This status will likely not be visible for
ae23c9
-#           the last job in a transaction.
ae23c9
-#
ae23c9
-# @pending: The job has finished its work, but has finalization steps that it
ae23c9
-#           needs to make prior to completing. These changes may require
ae23c9
-#           manual intervention by the management process if manual was set
ae23c9
-#           to true. These changes may still fail.
ae23c9
-#
ae23c9
-# @aborting: The job is in the process of being aborted, and will finish with
ae23c9
-#            an error. The job will afterwards report that it is @concluded.
ae23c9
-#            This status may not be visible to the management process.
ae23c9
-#
ae23c9
-# @concluded: The job has finished all work. If manual was set to true, the job
ae23c9
-#             will remain in the query list until it is dismissed.
ae23c9
-#
ae23c9
-# @null: The job is in the process of being dismantled. This state should not
ae23c9
-#        ever be visible externally.
ae23c9
-#
ae23c9
-# Since: 2.12
ae23c9
-##
ae23c9
-{ 'enum': 'JobStatus',
ae23c9
-  'data': ['undefined', 'created', 'running', 'paused', 'ready', 'standby',
ae23c9
-           'waiting', 'pending', 'aborting', 'concluded', 'null' ] }
ae23c9
-
ae23c9
-##
ae23c9
 # @BlockJobInfo:
ae23c9
 #
ae23c9
 # Information about a long-running block device operation.
ae23c9
diff --git a/qapi/job.json b/qapi/job.json
ae23c9
new file mode 100644
ae23c9
index 0000000..a472c0c
ae23c9
--- /dev/null
ae23c9
+++ b/qapi/job.json
ae23c9
@@ -0,0 +1,94 @@
ae23c9
+# -*- Mode: Python -*-
ae23c9
+
ae23c9
+##
ae23c9
+# == Background jobs
ae23c9
+##
ae23c9
+
ae23c9
+##
ae23c9
+# @JobType:
ae23c9
+#
ae23c9
+# Type of a background job.
ae23c9
+#
ae23c9
+# @commit: block commit job type, see "block-commit"
ae23c9
+#
ae23c9
+# @stream: block stream job type, see "block-stream"
ae23c9
+#
ae23c9
+# @mirror: drive mirror job type, see "drive-mirror"
ae23c9
+#
ae23c9
+# @backup: drive backup job type, see "drive-backup"
ae23c9
+#
ae23c9
+# Since: 1.7
ae23c9
+##
ae23c9
+{ 'enum': 'JobType',
ae23c9
+  'data': ['commit', 'stream', 'mirror', 'backup'] }
ae23c9
+
ae23c9
+##
ae23c9
+# @JobStatus:
ae23c9
+#
ae23c9
+# Indicates the present state of a given job in its lifetime.
ae23c9
+#
ae23c9
+# @undefined: Erroneous, default state. Should not ever be visible.
ae23c9
+#
ae23c9
+# @created: The job has been created, but not yet started.
ae23c9
+#
ae23c9
+# @running: The job is currently running.
ae23c9
+#
ae23c9
+# @paused: The job is running, but paused. The pause may be requested by
ae23c9
+#          either the QMP user or by internal processes.
ae23c9
+#
ae23c9
+# @ready: The job is running, but is ready for the user to signal completion.
ae23c9
+#         This is used for long-running jobs like mirror that are designed to
ae23c9
+#         run indefinitely.
ae23c9
+#
ae23c9
+# @standby: The job is ready, but paused. This is nearly identical to @paused.
ae23c9
+#           The job may return to @ready or otherwise be canceled.
ae23c9
+#
ae23c9
+# @waiting: The job is waiting for other jobs in the transaction to converge
ae23c9
+#           to the waiting state. This status will likely not be visible for
ae23c9
+#           the last job in a transaction.
ae23c9
+#
ae23c9
+# @pending: The job has finished its work, but has finalization steps that it
ae23c9
+#           needs to make prior to completing. These changes may require
ae23c9
+#           manual intervention by the management process if manual was set
ae23c9
+#           to true. These changes may still fail.
ae23c9
+#
ae23c9
+# @aborting: The job is in the process of being aborted, and will finish with
ae23c9
+#            an error. The job will afterwards report that it is @concluded.
ae23c9
+#            This status may not be visible to the management process.
ae23c9
+#
ae23c9
+# @concluded: The job has finished all work. If manual was set to true, the job
ae23c9
+#             will remain in the query list until it is dismissed.
ae23c9
+#
ae23c9
+# @null: The job is in the process of being dismantled. This state should not
ae23c9
+#        ever be visible externally.
ae23c9
+#
ae23c9
+# Since: 2.12
ae23c9
+##
ae23c9
+{ 'enum': 'JobStatus',
ae23c9
+  'data': ['undefined', 'created', 'running', 'paused', 'ready', 'standby',
ae23c9
+           'waiting', 'pending', 'aborting', 'concluded', 'null' ] }
ae23c9
+
ae23c9
+##
ae23c9
+# @JobVerb:
ae23c9
+#
ae23c9
+# Represents command verbs that can be applied to a job.
ae23c9
+#
ae23c9
+# @cancel: see @block-job-cancel
ae23c9
+#
ae23c9
+# @pause: see @block-job-pause
ae23c9
+#
ae23c9
+# @resume: see @block-job-resume
ae23c9
+#
ae23c9
+# @set-speed: see @block-job-set-speed
ae23c9
+#
ae23c9
+# @complete: see @block-job-complete
ae23c9
+#
ae23c9
+# @dismiss: see @block-job-dismiss
ae23c9
+#
ae23c9
+# @finalize: see @block-job-finalize
ae23c9
+#
ae23c9
+# Since: 2.12
ae23c9
+##
ae23c9
+{ 'enum': 'JobVerb',
ae23c9
+  'data': ['cancel', 'pause', 'resume', 'set-speed', 'complete', 'dismiss',
ae23c9
+           'finalize' ] }
ae23c9
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
ae23c9
index 25bce78..65b6dc2 100644
ae23c9
--- a/qapi/qapi-schema.json
ae23c9
+++ b/qapi/qapi-schema.json
ae23c9
@@ -84,6 +84,7 @@
ae23c9
 { 'include': 'crypto.json' }
ae23c9
 { 'include': 'block.json' }
ae23c9
 { 'include': 'char.json' }
ae23c9
+{ 'include': 'job.json' }
ae23c9
 { 'include': 'net.json' }
ae23c9
 { 'include': 'rocker.json' }
ae23c9
 { 'include': 'tpm.json' }
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9