mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
qapi: introduce new cmd option "allow-oob"
Here "oob" stands for "Out-Of-Band". When "allow-oob" is set, it means the command allows out-of-band execution. The "oob" idea is proposed by Markus Armbruster in following thread: https://lists.gnu.org/archive/html/qemu-devel/2017-09/msg02057.html This new "allow-oob" boolean will be exposed by "query-qmp-schema" as well for command entries, so that QMP clients can know which commands can be used in out-of-band calls. For example the command "migrate" originally looks like: {"name": "migrate", "ret-type": "17", "meta-type": "command", "arg-type": "86"} And it'll be changed into: {"name": "migrate", "ret-type": "17", "allow-oob": false, "meta-type": "command", "arg-type": "86"} This patch only provides the QMP interface level changes. It does not contain the real out-of-band execution implementation yet. Suggested-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180309090006.10018-18-peterx@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [eblake: rebase on introspection done by qlit] Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
bf1e730174
commit
876c67512e
7 changed files with 38 additions and 17 deletions
|
@ -921,7 +921,8 @@ def check_exprs(exprs):
|
|||
elif 'command' in expr:
|
||||
meta = 'command'
|
||||
check_keys(expr_elem, 'command', [],
|
||||
['data', 'returns', 'gen', 'success-response', 'boxed'])
|
||||
['data', 'returns', 'gen', 'success-response',
|
||||
'boxed', 'allow-oob'])
|
||||
elif 'event' in expr:
|
||||
meta = 'event'
|
||||
check_keys(expr_elem, 'event', [], ['data', 'boxed'])
|
||||
|
@ -1044,7 +1045,7 @@ class QAPISchemaVisitor(object):
|
|||
pass
|
||||
|
||||
def visit_command(self, name, info, arg_type, ret_type,
|
||||
gen, success_response, boxed):
|
||||
gen, success_response, boxed, allow_oob):
|
||||
pass
|
||||
|
||||
def visit_event(self, name, info, arg_type, boxed):
|
||||
|
@ -1421,7 +1422,7 @@ class QAPISchemaAlternateType(QAPISchemaType):
|
|||
|
||||
class QAPISchemaCommand(QAPISchemaEntity):
|
||||
def __init__(self, name, info, doc, arg_type, ret_type,
|
||||
gen, success_response, boxed):
|
||||
gen, success_response, boxed, allow_oob):
|
||||
QAPISchemaEntity.__init__(self, name, info, doc)
|
||||
assert not arg_type or isinstance(arg_type, str)
|
||||
assert not ret_type or isinstance(ret_type, str)
|
||||
|
@ -1432,6 +1433,7 @@ class QAPISchemaCommand(QAPISchemaEntity):
|
|||
self.gen = gen
|
||||
self.success_response = success_response
|
||||
self.boxed = boxed
|
||||
self.allow_oob = allow_oob
|
||||
|
||||
def check(self, schema):
|
||||
if self._arg_type_name:
|
||||
|
@ -1455,7 +1457,8 @@ class QAPISchemaCommand(QAPISchemaEntity):
|
|||
def visit(self, visitor):
|
||||
visitor.visit_command(self.name, self.info,
|
||||
self.arg_type, self.ret_type,
|
||||
self.gen, self.success_response, self.boxed)
|
||||
self.gen, self.success_response,
|
||||
self.boxed, self.allow_oob)
|
||||
|
||||
|
||||
class QAPISchemaEvent(QAPISchemaEntity):
|
||||
|
@ -1674,6 +1677,7 @@ class QAPISchema(object):
|
|||
gen = expr.get('gen', True)
|
||||
success_response = expr.get('success-response', True)
|
||||
boxed = expr.get('boxed', False)
|
||||
allow_oob = expr.get('allow-oob', False)
|
||||
if isinstance(data, OrderedDict):
|
||||
data = self._make_implicit_object_type(
|
||||
name, info, doc, 'arg', self._make_members(data, info))
|
||||
|
@ -1681,7 +1685,8 @@ class QAPISchema(object):
|
|||
assert len(rets) == 1
|
||||
rets = self._make_array_type(rets[0], info)
|
||||
self._def_entity(QAPISchemaCommand(name, info, doc, data, rets,
|
||||
gen, success_response, boxed))
|
||||
gen, success_response,
|
||||
boxed, allow_oob))
|
||||
|
||||
def _def_event(self, expr, info, doc):
|
||||
name = expr['event']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue