Commit 4747524f authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2019-06-12' into staging



QAPI patches for 2019-06-12

# gpg: Signature made Wed 12 Jun 2019 17:44:50 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qapi-2019-06-12:
  qapi: Simplify how QAPIDoc implements its state machine
  file-posix: Add dynamic-auto-read-only QAPI feature
  qapi: Allow documentation for features
  qapi: Disentangle QAPIDoc code
  tests/qapi-schema: Error case tests for features in structs
  tests/qapi-schema: Test for good feature lists in structs
  qapi: Add feature flags to struct types
  block/gluster: update .help of BLOCK_OPT_PREALLOC option
  block/file-posix: update .help of BLOCK_OPT_PREALLOC option
  qapi/block-core: update documentation of preallocation parameter
  qdev: Delete unused LostTickPolicy "merge"

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 8e23e34d 157dd363
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -2752,7 +2752,11 @@ static QemuOptsList raw_create_opts = {
        {
            .name = BLOCK_OPT_PREALLOC,
            .type = QEMU_OPT_STRING,
            .help = "Preallocation mode (allowed values: off, falloc, full)"
            .help = "Preallocation mode (allowed values: off"
#ifdef CONFIG_POSIX_FALLOCATE
                    ", falloc"
#endif
                    ", full)"
        },
        { /* end of list */ }
    }
+8 −1
Original line number Diff line number Diff line
@@ -98,7 +98,14 @@ static QemuOptsList qemu_gluster_create_opts = {
        {
            .name = BLOCK_OPT_PREALLOC,
            .type = QEMU_OPT_STRING,
            .help = "Preallocation mode (allowed values: off, full)"
            .help = "Preallocation mode (allowed values: off"
#ifdef CONFIG_GLUSTERFS_FALLOCATE
                    ", falloc"
#endif
#ifdef CONFIG_GLUSTERFS_ZEROFILL
                    ", full"
#endif
                    ")"
        },
        {
            .name = GLUSTER_OPT_DEBUG,
+38 −0
Original line number Diff line number Diff line
@@ -719,6 +719,34 @@ any non-empty complex type (struct, union, or alternate), and a
pointer to that QAPI type is passed as a single argument.


=== Features ===

Sometimes, the behaviour of QEMU changes compatibly, but without a
change in the QMP syntax (usually by allowing values or operations that
previously resulted in an error). QMP clients may still need to know
whether the extension is available.

For this purpose, a list of features can be specified for a struct type.
This is exposed to the client as a list of string, where each string
signals that this build of QEMU shows a certain behaviour.

In the schema, features can be specified as simple strings, for example:

{ 'struct': 'TestType',
  'data': { 'number': 'int' },
  'features': [ 'allow-negative-numbers' ] }

Another option is to specify features as dictionaries, where the key
'name' specifies the feature string to be exposed to clients:

{ 'struct': 'TestType',
  'data': { 'number': 'int' },
  'features': [ { 'name': 'allow-negative-numbers' } ] }

This expanded form is necessary if you want to make the feature
conditional (see below in "Configuring the schema").


=== Downstream extensions ===

QAPI schema names that are externally visible, say in the Client JSON
@@ -771,6 +799,16 @@ Example: a conditional 'bar' enum member.
  [ 'foo',
    { 'name' : 'bar', 'if': 'defined(IFCOND)' } ] }

Similarly, features can be specified as a dictionary with a 'name' and
an 'if' key.

Example: a conditional 'allow-negative-numbers' feature

{ 'struct': 'TestType',
  'data': { 'number': 'int' },
  'features': [ { 'name': 'allow-negative-numbers',
                  'if' 'defined(IFCOND)' } ] }

Please note that you are responsible to ensure that the C code will
compile with an arbitrary combination of conditions, since the
generators are unable to check it at this point.
+26 −7
Original line number Diff line number Diff line
@@ -2859,6 +2859,15 @@
#                         file is large, do not use in production.
#                         (default: off) (since: 3.0)
#
# Features:
# @dynamic-auto-read-only: If present, enabled auto-read-only means that the
#                          driver will open the image read-only at first,
#                          dynamically reopen the image file read-write when
#                          the first writer is attached to the node and reopen
#                          read-only when the last writer is detached. This
#                          allows giving QEMU write permissions only on demand
#                          when an operation actually needs write access.
#
# Since: 2.9
##
{ 'struct': 'BlockdevOptionsFile',
@@ -2868,7 +2877,9 @@
            '*aio': 'BlockdevAioOptions',
	    '*drop-cache': {'type': 'bool',
	                    'if': 'defined(CONFIG_LINUX)'},
            '*x-check-cache-dropped': 'bool' } }
            '*x-check-cache-dropped': 'bool' },
  'features': [ { 'name': 'dynamic-auto-read-only',
                  'if': 'defined(CONFIG_POSIX)' } ] }

##
# @BlockdevOptionsNull:
@@ -4121,7 +4132,10 @@
#
# @filename         Filename for the new image file
# @size             Size of the virtual disk in bytes
# @preallocation    Preallocation mode for the new image (default: off)
# @preallocation    Preallocation mode for the new image (default: off;
#                   allowed values: off,
#                   falloc (if defined CONFIG_POSIX_FALLOCATE),
#                   full (if defined CONFIG_POSIX))
# @nocow            Turn off copy-on-write (valid only on btrfs; default: off)
#
# Since: 2.12
@@ -4139,7 +4153,10 @@
#
# @location         Where to store the new image file
# @size             Size of the virtual disk in bytes
# @preallocation    Preallocation mode for the new image (default: off)
# @preallocation    Preallocation mode for the new image (default: off;
#                   allowed values: off,
#                   falloc (if defined CONFIG_GLUSTERFS_FALLOCATE),
#                   full (if defined CONFIG_GLUSTERFS_ZEROFILL))
#
# Since: 2.12
##
@@ -4243,7 +4260,8 @@
# @backing-fmt      Name of the block driver to use for the backing file
# @encrypt          Encryption options if the image should be encrypted
# @cluster-size     qcow2 cluster size in bytes (default: 65536)
# @preallocation    Preallocation mode for the new image (default: off)
# @preallocation    Preallocation mode for the new image (default: off;
#                   allowed values: off, falloc, full, metadata)
# @lazy-refcounts   True if refcounts may be updated lazily (default: off)
# @refcount-bits    Width of reference counts in bits (default: 16)
#
@@ -4426,7 +4444,8 @@
# @location         Where to store the new image file
# @size             Size of the virtual disk in bytes
# @backing-file     File name of a base image
# @preallocation    Preallocation mode (allowed values: off, full)
# @preallocation    Preallocation mode for the new image (default: off;
#                   allowed values: off, full)
# @redundancy       Redundancy of the image
# @object-size      Object size of the image
#
@@ -4461,8 +4480,8 @@
#
# @file             Node to create the image format on
# @size             Size of the virtual disk in bytes
# @preallocation    Preallocation mode for the new image (allowed values: off,
#                   metadata; default: off)
# @preallocation    Preallocation mode for the new image (default: off;
#                   allowed values: off, metadata)
#
# Since: 2.12
##
+5 −1
Original line number Diff line number Diff line
@@ -174,6 +174,9 @@
#            and may even differ from the order of the values of the
#            enum type of the @tag.
#
# @features: names of features associated with the type, in no particular
#            order. (since: 4.1)
#
# Values of this type are JSON object on the wire.
#
# Since: 2.5
@@ -181,7 +184,8 @@
{ 'struct': 'SchemaInfoObject',
  'data': { 'members': [ 'SchemaInfoObjectMember' ],
            '*tag': 'str',
            '*variants': [ 'SchemaInfoObjectVariant' ] } }
            '*variants': [ 'SchemaInfoObjectVariant' ],
            '*features': [ 'str' ] } }

##
# @SchemaInfoObjectMember:
Loading