cryptospore / rpms / qemu-kvm

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