aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi/introspect.py
diff options
context:
space:
mode:
authorPeter Krempa <pkrempa@redhat.com>2019-10-18 10:14:51 +0200
committerMarkus Armbruster <armbru@redhat.com>2019-10-22 13:54:13 +0200
commit23394b4c393c832aa3891533587ff97e04c70883 (patch)
tree191585355f00fd01fa66cb5d9da57aa7df96620f /scripts/qapi/introspect.py
parent758f272b6de428fcd523067f7a507cc7257d4ab0 (diff)
downloadqemu-23394b4c393c832aa3891533587ff97e04c70883.zip
qemu-23394b4c393c832aa3891533587ff97e04c70883.tar.gz
qemu-23394b4c393c832aa3891533587ff97e04c70883.tar.bz2
qapi: Add feature flags to commands
Similarly to features for struct types introduce the feature flags also for commands. This will allow notifying management layers of fixes and compatible changes in the behaviour of a command which may not be detectable any other way. The changes were heavily inspired by commit 6a8c0b51025. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191018081454.21369-3-armbru@redhat.com>
Diffstat (limited to 'scripts/qapi/introspect.py')
-rw-r--r--scripts/qapi/introspect.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/qapi/introspect.py b/scripts/qapi/introspect.py
index 4f25759..b3a463d 100644
--- a/scripts/qapi/introspect.py
+++ b/scripts/qapi/introspect.py
@@ -211,13 +211,18 @@ const QLitObject %(c_name)s = %(c_string)s;
for m in variants.variants]}, ifcond)
def visit_command(self, name, info, ifcond, arg_type, ret_type, gen,
- success_response, boxed, allow_oob, allow_preconfig):
+ success_response, boxed, allow_oob, allow_preconfig,
+ features):
arg_type = arg_type or self._schema.the_empty_object_type
ret_type = ret_type or self._schema.the_empty_object_type
obj = {'arg-type': self._use_type(arg_type),
'ret-type': self._use_type(ret_type)}
if allow_oob:
obj['allow-oob'] = allow_oob
+
+ if features:
+ obj['features'] = [(f.name, {'if': f.ifcond}) for f in features]
+
self._gen_qlit(name, 'command', obj, ifcond)
def visit_event(self, name, info, ifcond, arg_type, boxed):