Change in vdsm[master]: General json schema fixes

fsimonce at redhat.com fsimonce at redhat.com
Tue Sep 25 15:05:23 UTC 2012


Federico Simoncelli has uploaded a new change for review.

Change subject: General json schema fixes
......................................................................

General json schema fixes

In this patch:
* add the 'class' typeKind
* fix the info_return behaviour (now a string)
* misc fixes in vdsmapi-schema.json

Signed-off-by: Federico Simoncelli <fsimonce at redhat.com>
Change-Id: I453dcbdb63e1d7e61d22519982161d3c55496982
---
M vdsm_api/process-schema.py
M vdsm_api/vdsmapi-schema.json
2 files changed, 21 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/8198/1

diff --git a/vdsm_api/process-schema.py b/vdsm_api/process-schema.py
index ff466b0..154a8c5 100755
--- a/vdsm_api/process-schema.py
+++ b/vdsm_api/process-schema.py
@@ -32,7 +32,7 @@
     }
 
 # Symbols of these types are considered data types
-typeKinds = ('type', 'enum', 'map', 'union', 'alias')
+typeKinds = ('class', 'type', 'enum', 'map', 'union', 'alias')
 
 def read_symbol_comment(f, symbols):
     """
@@ -97,7 +97,7 @@
 
     # Find the already processed symbol information
     symbol = find_symbol(symbols, name)
-    symbol.update({'name': name, 'info_data': {}, 'info_return': {},
+    symbol.update({'name': name, 'info_data': {}, 'info_return': '',
                    'xxx': []})
 
     # Pop a blank line
@@ -134,7 +134,7 @@
         elif line.startswith('Notes:'):
             mode = 'notes'
             symbol['notes'] = line[6:]
-        elif mode in ('info_data', 'info_return'):
+        elif mode == 'info_data':
             # Try to read a parameter or return value
             m = re.search('^\@(.*?):\s*(.*)', line)
             if m:
@@ -145,6 +145,8 @@
             else:
                 # Just append it to the last one we added
                 symbol[mode][last_arg] += ' ' + line
+        elif mode == 'info_return':
+            symbol[mode] += line if symbol[mode] else ' ' + line
         else:
             raise ValueError("Line not valid: %s" % line)
 
@@ -262,10 +264,9 @@
 
     if 'command' in s and 'returns' in s:
         # Command return value(s)
-        names = strip_stars(s.get('returns', {}).keys())
-        types = filter_types(s.get('returns', {}).values())
-        details = [s['info_return'][n] for n in names]
-        attr_table('Returns', names, types, details)
+        name = filter_types([s.get('returns')])
+        detail = [s['info_return']]
+        attr_table('Returns', name, [None], detail)
 
     if 'notes' in s:
         f.write('Notes:\n<ul>\n')
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index c0440d2..fcf1b60 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -74,7 +74,7 @@
 # Since: 4.10.0
 ##
 {'type': 'NetworkOptions',
- 'data': {'*ipaddr', 'str', '*netmask': 'str', '*gateway': 'str',
+ 'data': {'*ipaddr': 'str', '*netmask': 'str', '*gateway': 'str',
           '*bootproto': 'str', '*delay': 'uint', '*onboot': 'str',
           '*bondingOptions', 'str'}}
 
@@ -445,6 +445,7 @@
 # Set MOM policy for different level of overcommitments.
 #
 # @policy:  MOM policy string.
+#
 # Since: 4.10.0
 ##
 {'command': {'class': 'Host', 'name': 'setMOMPolicy'},
@@ -455,19 +456,19 @@
 #
 # A collection of information about a task.
 #
-# @id:       The task @UUID
+# @id:          The task @UUID
 #
-# @verb:     The underlying operation to be performed by the task
+# @verb:        The underlying operation to be performed by the task
 #
-# @state:    Current task state (@TaskState)
+# @state:       Current task state (@TaskState)
 #
-# @code:     Return code from the underlying task verb
+# @code:        Return code from the underlying task verb
 #
-# @message:  Detailed error message from the underlying task verb
+# @message:     Detailed error message from the underlying task verb
 #
-# @result:   Final task result (@TaskResult)
+# @taskResult:  Final task result (@TaskResult)
 #
-# @tag:     The tag assigned to the task
+# @tag:         The tag assigned to the task
 #
 # Since: 4.10.0
 ##
@@ -3744,6 +3745,8 @@
 # @info:     Storage Pool information
 #
 # @dominfo:  Information about active Storage Domains
+#
+# Since: 4.10.0
 ##
 {'type': 'StoragePoolFullInfo',
  'data': {'info': 'StoragePoolInfo', 'dominfo': 'StoragePoolDomainInfoMap'}}
@@ -4819,6 +4822,8 @@
 # @migrationPort:  The port used for migration (currently always 0)
 #
 # @params:         The VM status
+#
+# Since: 4.10.0
 ##
 {'type': 'MigrationCreateState',
  'data': {'migrationPort': 'int', 'params': 'VmFullStatus'}}


--
To view, visit http://gerrit.ovirt.org/8198
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I453dcbdb63e1d7e61d22519982161d3c55496982
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce at redhat.com>


More information about the vdsm-patches mailing list