Skip to contentSkip to conversation

qapi: make the json schema files more regular.

PATCH Applied David Anderson 4 participants 7 messages Sep 22, 2016 – Oct 9, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qapi: make the json schema files more regular.

This makes it easier to parse the schema file for tool generation:
each paragraph is either a non-docstring comment, or a docstring immediately followed by a Python dict describing an API item.

---
 qapi-schema.json     | 3 +--
 qapi/block-core.json | 5 -----
 2 files changed, 1 insertion(+), 7 deletions(-)
qapi-schema.json +1 -2
index e507061..edd803f 100644
@@ -752,6 +752,7 @@
             'cpu-throttle-increment': 'int',
             'tls-creds': 'str',
             'tls-hostname': 'str'} }
+
 ##
 # @query-migrate-parameters
 #
@@ -4115,7 +4116,6 @@
 #
 # Since 1.6
 ##
-
 { 'struct': 'RxFilterInfo',
   'data': {
     'name':               'str',
@@ -4335,7 +4335,6 @@
 #
 # Since: 2.1
 ##
-
 { 'struct': 'Memdev',
   'data': {
     'size':       'size',
qapi/block-core.json +0 -5
index 24223fd..e12fbd3 100644
@@ -25,7 +25,6 @@
 # Since: 1.3
 #
 ##
-
 { 'struct': 'SnapshotInfo',
   'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
             'date-sec': 'int', 'date-nsec': 'int',
@@ -81,7 +80,6 @@
 #
 # Since: 1.7
 ##
-
 { 'union': 'ImageInfoSpecific',
   'data': {
       'qcow2': 'ImageInfoSpecificQCow2',
@@ -129,7 +127,6 @@
 # Since: 1.3
 #
 ##
-
 { 'struct': 'ImageInfo',
   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
            '*actual-size': 'int', 'virtual-size': 'int',
@@ -181,7 +178,6 @@
 # Since: 1.4
 #
 ##
-
 { 'struct': 'ImageCheck',
   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
@@ -518,7 +514,6 @@
 #
 # Since: 2.5
 ##
-
 { 'struct': 'BlockDeviceTimedStats',
   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
Signature · 1 line
2.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · David Anderson

This makes it easier to parse the schema file for tool generation:
each paragraph is either a non-docstring comment, or a docstring immediately followed by a Python dict describing an API item.

---
 qapi-schema.json     | 3 +--
 qapi/block-core.json | 5 -----
 2 files changed, 1 insertion(+), 7 deletions(-)

Related to the work Marc-Andre is already doing, but fine to take now.

Quoted 74 lines
qapi-schema.json +1 -2
index e507061..edd803f 100644
@@ -752,6 +752,7 @@
             'cpu-throttle-increment': 'int',
             'tls-creds': 'str',
             'tls-hostname': 'str'} }
+
 ##
 # @query-migrate-parameters
 #
@@ -4115,7 +4116,6 @@
 #
 # Since 1.6
 ##
-
 { 'struct': 'RxFilterInfo',
   'data': {
     'name':               'str',
@@ -4335,7 +4335,6 @@
 #
 # Since: 2.1
 ##
-
 { 'struct': 'Memdev',
   'data': {
     'size':       'size',
qapi/block-core.json +0 -5
index 24223fd..e12fbd3 100644
@@ -25,7 +25,6 @@
 # Since: 1.3
 #
 ##
-
 { 'struct': 'SnapshotInfo',
   'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
             'date-sec': 'int', 'date-nsec': 'int',
@@ -81,7 +80,6 @@
 #
 # Since: 1.7
 ##
-
 { 'union': 'ImageInfoSpecific',
   'data': {
       'qcow2': 'ImageInfoSpecificQCow2',
@@ -129,7 +127,6 @@
 # Since: 1.3
 #
 ##
-
 { 'struct': 'ImageInfo',
   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
            '*actual-size': 'int', 'virtual-size': 'int',
@@ -181,7 +178,6 @@
 # Since: 1.4
 #
 ##
-
 { 'struct': 'ImageCheck',
   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int',
@@ -518,7 +514,6 @@
 #
 # Since: 2.5
 ##
-
 { 'struct': 'BlockDeviceTimedStats',
   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#2 lore raw
Quoted 5 lines · Eric Blake
Quoted 4 lines · David Anderson

This makes it easier to parse the schema file for tool generation:
each paragraph is either a non-docstring comment, or a docstring immediately followed by a Python dict describing an API item.

Quoted 8 lines
Quoted 5 lines
---
 qapi-schema.json     | 3 +--
 qapi/block-core.json | 5 -----
 2 files changed, 1 insertion(+), 7 deletions(-)

Related to the work Marc-Andre is already doing, but fine to take now.

Do you have a link to that work? It sounds like the schema format may be changing, which is relevant to my interests since I'm trying to parse it :).

- Dave

Quoted 84 lines
Quoted 58 lines
qapi-schema.json +1 -2
index e507061..edd803f 100644
@@ -752,6 +752,7 @@
             'cpu-throttle-increment': 'int',
             'tls-creds': 'str',
             'tls-hostname': 'str'} }
+
 ##
 # @query-migrate-parameters
 #
@@ -4115,7 +4116,6 @@
 #
 # Since 1.6
 ##
-
 { 'struct': 'RxFilterInfo',
   'data': {
     'name':               'str',
@@ -4335,7 +4335,6 @@
 #
 # Since: 2.1
 ##
-
 { 'struct': 'Memdev',
   'data': {
     'size':       'size',
qapi/block-core.json +0 -3
index 24223fd..e12fbd3 100644
@@ -25,7 +25,6 @@
 # Since: 1.3
 #
 ##
-
 { 'struct': 'SnapshotInfo',
   'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
             'date-sec': 'int', 'date-nsec': 'int',
@@ -81,7 +80,6 @@
 #
 # Since: 1.7
 ##
-
 { 'union': 'ImageInfoSpecific',
   'data': {
       'qcow2': 'ImageInfoSpecificQCow2',
@@ -129,7 +127,6 @@
 # Since: 1.3
 #
 ##
-
 { 'struct': 'ImageInfo',
   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
            '*actual-size': 'int', 'virtual-size': 'int',

qapi/block-core.json line 183

Quoted 7 lines
qapi/block-core.json +0 -1
@@ -181,7 +178,6 @@
 # Since: 1.4
 #
 ##
-
 { 'struct': 'ImageCheck',
   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks':

'int',

qapi/block-core.json line 519

Quoted 9 lines
qapi/block-core.json +0 -1
@@ -518,7 +514,6 @@
 #
 # Since: 2.5
 ##
-
 { 'struct': 'BlockDeviceTimedStats',
   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',

--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org

#3 lore raw

Hi

----- Original Message -----

Quoted 13 lines · Eric Blake
Quoted 12 lines · David Anderson
Quoted 9 lines

This makes it easier to parse the schema file for tool generation:
each paragraph is either a non-docstring comment, or a docstring immediately followed by a Python dict describing an API item.

---
 qapi-schema.json     | 3 +--
 qapi/block-core.json | 5 -----
 2 files changed, 1 insertion(+), 7 deletions(-)
Quoted 6 lines
Quoted 2 lines

Related to the work Marc-Andre is already doing, but fine to take now.

Do you have a link to that work? It sounds like the schema format may be changing, which is relevant to my interests since I'm trying to parse it :).

I wrote a schema doc parser/generator: see http://patchew.org/QEMU/20160922155808.8504-1-marcandre.lureau%40redhat.com/.

The format is not changing, just augmented a bit.

Quoted 88 lines

- Dave

Quoted 84 lines
Quoted 58 lines
qapi-schema.json +1 -2
index e507061..edd803f 100644
@@ -752,6 +752,7 @@
             'cpu-throttle-increment': 'int',
             'tls-creds': 'str',
             'tls-hostname': 'str'} }
+
 ##
 # @query-migrate-parameters
 #
@@ -4115,7 +4116,6 @@
 #
 # Since 1.6
 ##
-
 { 'struct': 'RxFilterInfo',
   'data': {
     'name':               'str',
@@ -4335,7 +4335,6 @@
 #
 # Since: 2.1
 ##
-
 { 'struct': 'Memdev',
   'data': {
     'size':       'size',
qapi/block-core.json +0 -3
index 24223fd..e12fbd3 100644
@@ -25,7 +25,6 @@
 # Since: 1.3
 #
 ##
-
 { 'struct': 'SnapshotInfo',
   'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int',
             'date-sec': 'int', 'date-nsec': 'int',
@@ -81,7 +80,6 @@
 #
 # Since: 1.7
 ##
-
 { 'union': 'ImageInfoSpecific',
   'data': {
       'qcow2': 'ImageInfoSpecificQCow2',
@@ -129,7 +127,6 @@
 # Since: 1.3
 #
 ##
-
 { 'struct': 'ImageInfo',
   'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool',
            '*actual-size': 'int', 'virtual-size': 'int',

qapi/block-core.json line 183

Quoted 7 lines
qapi/block-core.json +0 -1
@@ -181,7 +178,6 @@
 # Since: 1.4
 #
 ##
-
 { 'struct': 'ImageCheck',
   'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int',
            '*image-end-offset': 'int', '*corruptions': 'int', '*leaks':

'int',

qapi/block-core.json line 519

Quoted 9 lines
qapi/block-core.json +0 -1
@@ -518,7 +514,6 @@
 #
 # Since: 2.5
 ##
-
 { 'struct': 'BlockDeviceTimedStats',
   'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int',
             'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int',

--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org

#4 lore raw
In reply to David Anderson
Quoted 13 lines · David Anderson
Quoted 11 lines · Eric Blake
Quoted 9 lines · David Anderson

This makes it easier to parse the schema file for tool generation:
each paragraph is either a non-docstring comment, or a docstring immediately followed by a Python dict describing an API item.

---
 qapi-schema.json     | 3 +--
 qapi/block-core.json | 5 -----
 2 files changed, 1 insertion(+), 7 deletions(-)
Quoted 5 lines
Quoted 2 lines

Related to the work Marc-Andre is already doing, but fine to take now.

Do you have a link to that work? It sounds like the schema format may be changing, which is relevant to my interests since I'm trying to parse it :).

https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg05782.html

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#5 lore raw
In reply to David Anderson
Quoted 3 lines · David Anderson

This makes it easier to parse the schema file for tool generation:
each paragraph is either a non-docstring comment, or a docstring immediately followed by a Python dict describing an API item.

Applied to -trivial, thanks!

/mjt

#6 lore raw

This patch doesn't seem to be in the main repo yet. Any idea when it might land?

- Dave

Quoted 11 lines · Michael Tokarev
Quoted 4 lines · David Anderson

This makes it easier to parse the schema file for tool generation:
each paragraph is either a non-docstring comment, or a docstring immediately followed by a Python dict describing an API item.

Applied to -trivial, thanks!

/mjt