@@ -332,7 +332,7 @@ def visit_alternate_type(self, name, info, ifcond, features, variants):
def visit_command(self, name, info, ifcond, features, arg_type,
ret_type, gen, success_response, boxed, allow_oob,
- allow_preconfig, coroutine):
+ allow_preconfig, coroutine, allow_init_config):
doc = self._cur_doc
self._add_doc('Command',
self._nodes_for_arguments(doc,
@@ -27,6 +27,7 @@ typedef enum QmpCommandOptions
QCO_ALLOW_PRECONFIG = (1U << 2),
QCO_COROUTINE = (1U << 3),
QCO_DEPRECATED = (1U << 4),
+ QCO_ALLOW_INIT_CONFIG = (1U << 5),
} QmpCommandOptions;
typedef struct QmpCommand
@@ -1004,6 +1004,11 @@ bool qmp_command_available(const QmpCommand *cmd, Error **errp)
return true;
}
break;
+ case MACHINE_INIT_PHASE_INITIALIZED:
+ if (cmd->options & QCO_ALLOW_INIT_CONFIG) {
+ return true;
+ }
+ break;
case MACHINE_INIT_PHASE_READY:
/* All commands are available when the machine is ready */
return true;
@@ -214,7 +214,8 @@ def gen_register_command(name: str,
success_response: bool,
allow_oob: bool,
allow_preconfig: bool,
- coroutine: bool) -> str:
+ coroutine: bool,
+ allow_init_config: bool) -> str:
options = []
if 'deprecated' in [f.name for f in features]:
@@ -228,6 +229,8 @@ def gen_register_command(name: str,
options += ['QCO_ALLOW_PRECONFIG']
if coroutine:
options += ['QCO_COROUTINE']
+ if allow_init_config:
+ options += ['QCO_ALLOW_INIT_CONFIG']
if not options:
options = ['QCO_NO_OPTIONS']
@@ -310,7 +313,8 @@ def visit_command(self,
boxed: bool,
allow_oob: bool,
allow_preconfig: bool,
- coroutine: bool) -> None:
+ coroutine: bool,
+ allow_init_config: bool) -> None:
if not gen:
return
# FIXME: If T is a user-defined type, the user is responsible
@@ -331,7 +335,7 @@ def visit_command(self,
with ifcontext(ifcond, self._genh, self._genc):
self._genc.add(gen_register_command(
name, features, success_response, allow_oob,
- allow_preconfig, coroutine))
+ allow_preconfig, coroutine, allow_init_config))
def gen_commands(schema: QAPISchema,
@@ -107,7 +107,8 @@ def check_flags(expr, info):
if key in expr and expr[key] is not False:
raise QAPISemError(
info, "flag '%s' may only use false value" % key)
- for key in ['boxed', 'allow-oob', 'allow-preconfig', 'coroutine']:
+ for key in ['boxed', 'allow-oob', 'allow-preconfig', 'coroutine',
+ 'allow-init-config']:
if key in expr and expr[key] is not True:
raise QAPISemError(
info, "flag '%s' may only use true value" % key)
@@ -378,7 +379,7 @@ def check_exprs(exprs):
['command'],
['data', 'returns', 'boxed', 'if', 'features',
'gen', 'success-response', 'allow-oob',
- 'allow-preconfig', 'coroutine'])
+ 'allow-preconfig', 'coroutine', 'allow-init-config'])
normalize_members(expr.get('data'))
check_command(expr, info)
elif meta == 'event':
@@ -353,7 +353,8 @@ def visit_command(self, name: str, info: Optional[QAPISourceInfo],
arg_type: Optional[QAPISchemaObjectType],
ret_type: Optional[QAPISchemaType], gen: bool,
success_response: bool, boxed: bool, allow_oob: bool,
- allow_preconfig: bool, coroutine: bool) -> None:
+ allow_preconfig: bool, coroutine: bool,
+ allow_init_config: bool) -> None:
assert self._schema is not None
arg_type = arg_type or self._schema.the_empty_object_type
@@ -130,7 +130,7 @@ def visit_alternate_type(self, name, info, ifcond, features, variants):
def visit_command(self, name, info, ifcond, features,
arg_type, ret_type, gen, success_response, boxed,
- allow_oob, allow_preconfig, coroutine):
+ allow_oob, allow_preconfig, coroutine, allow_init_config):
pass
def visit_event(self, name, info, ifcond, features, arg_type, boxed):
@@ -746,7 +746,7 @@ class QAPISchemaCommand(QAPISchemaEntity):
def __init__(self, name, info, doc, ifcond, features,
arg_type, ret_type,
gen, success_response, boxed, allow_oob, allow_preconfig,
- coroutine):
+ coroutine, allow_init_config):
super().__init__(name, info, doc, ifcond, features)
assert not arg_type or isinstance(arg_type, str)
assert not ret_type or isinstance(ret_type, str)
@@ -760,6 +760,7 @@ def __init__(self, name, info, doc, ifcond, features,
self.allow_oob = allow_oob
self.allow_preconfig = allow_preconfig
self.coroutine = coroutine
+ self.allow_init_config = allow_init_config
def check(self, schema):
super().check(schema)
@@ -803,7 +804,7 @@ def visit(self, visitor):
self.name, self.info, self.ifcond, self.features,
self.arg_type, self.ret_type, self.gen, self.success_response,
self.boxed, self.allow_oob, self.allow_preconfig,
- self.coroutine)
+ self.coroutine, self.allow_init_config)
class QAPISchemaEvent(QAPISchemaEntity):
@@ -1111,6 +1112,7 @@ def _def_command(self, expr, info, doc):
allow_oob = expr.get('allow-oob', False)
allow_preconfig = expr.get('allow-preconfig', False)
coroutine = expr.get('coroutine', False)
+ allow_init_config = expr.get('allow-init-config', False)
ifcond = expr.get('if')
features = self._make_features(expr.get('features'), info)
if isinstance(data, OrderedDict):
@@ -1124,7 +1126,7 @@ def _def_command(self, expr, info, doc):
data, rets,
gen, success_response,
boxed, allow_oob, allow_preconfig,
- coroutine))
+ coroutine, allow_init_config))
def _def_event(self, expr, info, doc):
name = expr['event']
This option will be used to select the commands which are allowed to execute during the MACHINE_INIT_PHASE_INITIALIZED machine phase. Signed-off-by: Mirela Grujic <mirela.grujic@greensocs.com> --- docs/sphinx/qapidoc.py | 2 +- include/qapi/qmp/dispatch.h | 1 + softmmu/qdev-monitor.c | 5 +++++ scripts/qapi/commands.py | 10 +++++++--- scripts/qapi/expr.py | 5 +++-- scripts/qapi/introspect.py | 3 ++- scripts/qapi/schema.py | 10 ++++++---- 7 files changed, 25 insertions(+), 11 deletions(-)