* [Qemu-devel] [PATCH v5 0/7] Reenable hmp for preconfig mode
@ 2018-06-20 15:39 Dr. David Alan Gilbert (git)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 1/7] hmp: Add flag for preconfig commands Dr. David Alan Gilbert (git)
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2018-06-20 15:39 UTC (permalink / raw)
To: qemu-devel, armbru, imammedo, peterx
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Reenable HMP in preconfig mode; it's pretty
easy and anyway I want to do a similar thing for OOB eventually.
We'll want to enable more commands in preconfig mode to make it
useful at some point.
Dave
v5
Drop info usbhost as per Gerd's comments
Dr. David Alan Gilbert (6):
hmp: Add flag for preconfig commands
hmp: Allow help on preconfig commands
hmp: Restrict auto-complete in preconfig
hmp: Add commands for preconfig
hmp: add exit_preconfig
hmp: Allow HMP in preconfig state again
Igor Mammedov (1):
qmp: Enable a few commands in preconfig state
hmp-commands-info.hx | 11 +++++++++++
hmp-commands.hx | 23 +++++++++++++++++++++++
hmp.c | 8 ++++++++
hmp.h | 1 +
monitor.c | 43 ++++++++++++++++++++++++++++++++++---------
qapi/char.json | 3 ++-
qapi/misc.json | 27 +++++++++++++++++----------
7 files changed, 96 insertions(+), 20 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v5 1/7] hmp: Add flag for preconfig commands
2018-06-20 15:39 [Qemu-devel] [PATCH v5 0/7] Reenable hmp for preconfig mode Dr. David Alan Gilbert (git)
@ 2018-06-20 15:39 ` Dr. David Alan Gilbert (git)
2018-06-21 8:44 ` Igor Mammedov
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 2/7] hmp: Allow help on " Dr. David Alan Gilbert (git)
` (5 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2018-06-20 15:39 UTC (permalink / raw)
To: qemu-devel, armbru, imammedo, peterx
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Add a flag to command definitions to allow them to be used in preconfig
and check it.
If users try to use commands that aren't available, tell them to use
the exit_preconfig comand we're adding in a few patches.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
monitor.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/monitor.c b/monitor.c
index 885e000f9b..8dc86c0c3c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -128,6 +128,7 @@ typedef struct mon_cmd_t {
const char *args_type;
const char *params;
const char *help;
+ const char *flags; /* p=preconfig */
void (*cmd)(Monitor *mon, const QDict *qdict);
/* @sub_table is a list of 2nd level of commands. If it does not exist,
* cmd should be used. If it exists, sub_table[?].cmd should be
@@ -958,6 +959,19 @@ static int parse_cmdline(const char *cmdline,
return -1;
}
+/*
+ * Returns true if the command can be executed in preconfig mode
+ * i.e. it has the 'p' flag.
+ */
+static bool cmd_can_preconfig(const mon_cmd_t *cmd)
+{
+ if (!cmd->flags) {
+ return false;
+ }
+
+ return strchr(cmd->flags, 'p');
+}
+
static void help_cmd_dump_one(Monitor *mon,
const mon_cmd_t *cmd,
char **prefix_args,
@@ -3041,6 +3055,12 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
(int)(p - cmdp_start), cmdp_start);
return NULL;
}
+ if (runstate_check(RUN_STATE_PRECONFIG) && !cmd_can_preconfig(cmd)) {
+ monitor_printf(mon, "Command '%.*s' not available with -preconfig "
+ "until after exit_preconfig.\n",
+ (int)(p - cmdp_start), cmdp_start);
+ return NULL;
+ }
/* filter out following useless space */
while (qemu_isspace(*p)) {
--
2.17.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v5 2/7] hmp: Allow help on preconfig commands
2018-06-20 15:39 [Qemu-devel] [PATCH v5 0/7] Reenable hmp for preconfig mode Dr. David Alan Gilbert (git)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 1/7] hmp: Add flag for preconfig commands Dr. David Alan Gilbert (git)
@ 2018-06-20 15:39 ` Dr. David Alan Gilbert (git)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 3/7] hmp: Restrict auto-complete in preconfig Dr. David Alan Gilbert (git)
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2018-06-20 15:39 UTC (permalink / raw)
To: qemu-devel, armbru, imammedo, peterx
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Allow the 'help' command in preconfig state but
make it only list the preconfig commands.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
---
hmp-commands.hx | 1 +
monitor.c | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 0de7c4c29e..3094294e5b 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -15,6 +15,7 @@ ETEXI
.params = "[cmd]",
.help = "show the help",
.cmd = do_help_cmd,
+ .flags = "p",
},
STEXI
diff --git a/monitor.c b/monitor.c
index 8dc86c0c3c..6fc20c4889 100644
--- a/monitor.c
+++ b/monitor.c
@@ -979,6 +979,10 @@ static void help_cmd_dump_one(Monitor *mon,
{
int i;
+ if (runstate_check(RUN_STATE_PRECONFIG) && !cmd_can_preconfig(cmd)) {
+ return;
+ }
+
for (i = 0; i < prefix_args_nb; i++) {
monitor_printf(mon, "%s ", prefix_args[i]);
}
@@ -1001,7 +1005,9 @@ static void help_cmd_dump(Monitor *mon, const mon_cmd_t *cmds,
/* Find one entry to dump */
for (cmd = cmds; cmd->name != NULL; cmd++) {
- if (compare_cmd(args[arg_index], cmd->name)) {
+ if (compare_cmd(args[arg_index], cmd->name) &&
+ ((!runstate_check(RUN_STATE_PRECONFIG) ||
+ cmd_can_preconfig(cmd)))) {
if (cmd->sub_table) {
/* continue with next arg */
help_cmd_dump(mon, cmd->sub_table,
--
2.17.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v5 3/7] hmp: Restrict auto-complete in preconfig
2018-06-20 15:39 [Qemu-devel] [PATCH v5 0/7] Reenable hmp for preconfig mode Dr. David Alan Gilbert (git)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 1/7] hmp: Add flag for preconfig commands Dr. David Alan Gilbert (git)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 2/7] hmp: Allow help on " Dr. David Alan Gilbert (git)
@ 2018-06-20 15:39 ` Dr. David Alan Gilbert (git)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 4/7] qmp: Enable a few commands in preconfig state Dr. David Alan Gilbert (git)
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2018-06-20 15:39 UTC (permalink / raw)
To: qemu-devel, armbru, imammedo, peterx
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Don't show the commands that aren't available.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
---
monitor.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/monitor.c b/monitor.c
index 6fc20c4889..0c32308fb2 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4016,12 +4016,17 @@ static void monitor_find_completion_by_table(Monitor *mon,
cmdname = args[0];
readline_set_completion_index(mon->rs, strlen(cmdname));
for (cmd = cmd_table; cmd->name != NULL; cmd++) {
- cmd_completion(mon, cmdname, cmd->name);
+ if (!runstate_check(RUN_STATE_PRECONFIG) ||
+ cmd_can_preconfig(cmd)) {
+ cmd_completion(mon, cmdname, cmd->name);
+ }
}
} else {
/* find the command */
for (cmd = cmd_table; cmd->name != NULL; cmd++) {
- if (compare_cmd(args[0], cmd->name)) {
+ if (compare_cmd(args[0], cmd->name) &&
+ (!runstate_check(RUN_STATE_PRECONFIG) ||
+ cmd_can_preconfig(cmd))) {
break;
}
}
--
2.17.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v5 4/7] qmp: Enable a few commands in preconfig state
2018-06-20 15:39 [Qemu-devel] [PATCH v5 0/7] Reenable hmp for preconfig mode Dr. David Alan Gilbert (git)
` (2 preceding siblings ...)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 3/7] hmp: Restrict auto-complete in preconfig Dr. David Alan Gilbert (git)
@ 2018-06-20 15:39 ` Dr. David Alan Gilbert (git)
2018-06-20 18:37 ` Eric Blake
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 5/7] hmp: Add commands for preconfig Dr. David Alan Gilbert (git)
` (2 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2018-06-20 15:39 UTC (permalink / raw)
To: qemu-devel, armbru, imammedo, peterx
From: Igor Mammedov <imammedo@redhat.com>
Commands query-chardev, query-version, query-name, query-uuid,
query-iothreads, query-memdev are informational and do not depend on
the machine being initialized. Make them available in preconfig
runstate to make the latter a little bit more useful.
The generic qom commands don't depend on the machine being initialized
either; so enabled qom-list, qom-get, qom-set, qom-list-types,
qom-list-properties.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
qapi/char.json | 3 ++-
qapi/misc.json | 27 +++++++++++++++++----------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/qapi/char.json b/qapi/char.json
index ae19dcd1ed..60f31d83fc 100644
--- a/qapi/char.json
+++ b/qapi/char.json
@@ -62,7 +62,8 @@
# }
#
##
-{ 'command': 'query-chardev', 'returns': ['ChardevInfo'] }
+{ 'command': 'query-chardev', 'returns': ['ChardevInfo'],
+ 'allow-preconfig': true }
##
# @ChardevBackendInfo:
diff --git a/qapi/misc.json b/qapi/misc.json
index f83a63a0ab..fa86831ec3 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -117,7 +117,8 @@
# }
#
##
-{ 'command': 'query-version', 'returns': 'VersionInfo' }
+{ 'command': 'query-version', 'returns': 'VersionInfo',
+ 'allow-preconfig': true }
##
# @CommandInfo:
@@ -241,7 +242,7 @@
# <- { "return": { "name": "qemu-name" } }
#
##
-{ 'command': 'query-name', 'returns': 'NameInfo' }
+{ 'command': 'query-name', 'returns': 'NameInfo', 'allow-preconfig': true }
##
# @KvmInfo:
@@ -301,7 +302,7 @@
# <- { "return": { "UUID": "550e8400-e29b-41d4-a716-446655440000" } }
#
##
-{ 'command': 'query-uuid', 'returns': 'UuidInfo' }
+{ 'command': 'query-uuid', 'returns': 'UuidInfo', 'allow-preconfig': true }
##
# @EventInfo:
@@ -710,7 +711,8 @@
# }
#
##
-{ 'command': 'query-iothreads', 'returns': ['IOThreadInfo'] }
+{ 'command': 'query-iothreads', 'returns': ['IOThreadInfo'],
+ 'allow-preconfig': true }
##
# @BalloonInfo:
@@ -1408,7 +1410,8 @@
##
{ 'command': 'qom-list',
'data': { 'path': 'str' },
- 'returns': [ 'ObjectPropertyInfo' ] }
+ 'returns': [ 'ObjectPropertyInfo' ],
+ 'allow-preconfig': true }
##
# @qom-get:
@@ -1444,7 +1447,8 @@
##
{ 'command': 'qom-get',
'data': { 'path': 'str', 'property': 'str' },
- 'returns': 'any' }
+ 'returns': 'any',
+ 'allow-preconfig': true }
##
# @qom-set:
@@ -1461,7 +1465,8 @@
# Since: 1.2
##
{ 'command': 'qom-set',
- 'data': { 'path': 'str', 'property': 'str', 'value': 'any' } }
+ 'data': { 'path': 'str', 'property': 'str', 'value': 'any' },
+ 'allow-preconfig': true }
##
# @change:
@@ -1543,7 +1548,8 @@
##
{ 'command': 'qom-list-types',
'data': { '*implements': 'str', '*abstract': 'bool' },
- 'returns': [ 'ObjectTypeInfo' ] }
+ 'returns': [ 'ObjectTypeInfo' ],
+ 'allow-preconfig': true }
##
# @device-list-properties:
@@ -1581,7 +1587,8 @@
##
{ 'command': 'qom-list-properties',
'data': { 'typename': 'str'},
- 'returns': [ 'ObjectPropertyInfo' ] }
+ 'returns': [ 'ObjectPropertyInfo' ],
+ 'allow-preconfig': true }
##
# @xen-set-global-dirty-log:
@@ -2902,7 +2909,7 @@
# }
#
##
-{ 'command': 'query-memdev', 'returns': ['Memdev'] }
+{ 'command': 'query-memdev', 'returns': ['Memdev'], 'allow-preconfig': true }
##
# @PCDIMMDeviceInfo:
--
2.17.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v5 5/7] hmp: Add commands for preconfig
2018-06-20 15:39 [Qemu-devel] [PATCH v5 0/7] Reenable hmp for preconfig mode Dr. David Alan Gilbert (git)
` (3 preceding siblings ...)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 4/7] qmp: Enable a few commands in preconfig state Dr. David Alan Gilbert (git)
@ 2018-06-20 15:39 ` Dr. David Alan Gilbert (git)
2018-06-21 8:56 ` Igor Mammedov
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 6/7] hmp: add exit_preconfig Dr. David Alan Gilbert (git)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 7/7] hmp: Allow HMP in preconfig state again Dr. David Alan Gilbert (git)
6 siblings, 1 reply; 12+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2018-06-20 15:39 UTC (permalink / raw)
To: qemu-devel, armbru, imammedo, peterx
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Allow a bunch of the info commands to be used in preconfig.
version, chardev, name, uuid,memdev, iothreads
Were enabled in QMP in the previous patch from Igor
status, hotpluggable_cpus
Was enabled in the original allow-preconfig series
history
is HMP specific
qom-tree, numa
Don't have a QMP equivalent
Also enable the qom commands qom-list and qom-set.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
hmp-commands-info.hx | 11 +++++++++++
hmp-commands.hx | 3 +++
2 files changed, 14 insertions(+)
diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
index ddfcd5adcc..874ff07583 100644
--- a/hmp-commands-info.hx
+++ b/hmp-commands-info.hx
@@ -19,6 +19,7 @@ ETEXI
.params = "",
.help = "show the version of QEMU",
.cmd = hmp_info_version,
+ .flags = "p",
},
STEXI
@@ -47,6 +48,7 @@ ETEXI
.params = "",
.help = "show the character devices",
.cmd = hmp_info_chardev,
+ .flags = "p",
},
STEXI
@@ -165,6 +167,7 @@ ETEXI
.params = "",
.help = "show the command line history",
.cmd = hmp_info_history,
+ .flags = "p",
},
STEXI
@@ -315,6 +318,7 @@ ETEXI
.params = "",
.help = "show NUMA information",
.cmd = hmp_info_numa,
+ .flags = "p",
},
STEXI
@@ -399,6 +403,7 @@ ETEXI
.params = "",
.help = "show the current VM status (running|paused)",
.cmd = hmp_info_status,
+ .flags = "p",
},
STEXI
@@ -457,6 +462,7 @@ ETEXI
.params = "",
.help = "show the current VM name",
.cmd = hmp_info_name,
+ .flags = "p",
},
STEXI
@@ -471,6 +477,7 @@ ETEXI
.params = "",
.help = "show the current VM UUID",
.cmd = hmp_info_uuid,
+ .flags = "p",
},
STEXI
@@ -613,6 +620,7 @@ ETEXI
.params = "[path]",
.help = "show QOM composition tree",
.cmd = hmp_info_qom_tree,
+ .flags = "p",
},
STEXI
@@ -671,6 +679,7 @@ ETEXI
.params = "",
.help = "show memory backends",
.cmd = hmp_info_memdev,
+ .flags = "p",
},
STEXI
@@ -699,6 +708,7 @@ ETEXI
.params = "",
.help = "show iothreads",
.cmd = hmp_info_iothreads,
+ .flags = "p",
},
STEXI
@@ -829,6 +839,7 @@ ETEXI
.params = "",
.help = "Show information about hotpluggable CPUs",
.cmd = hmp_hotpluggable_cpus,
+ .flags = "p",
},
STEXI
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 3094294e5b..4bdf8e2090 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1828,6 +1828,7 @@ ETEXI
.params = "path",
.help = "list QOM properties",
.cmd = hmp_qom_list,
+ .flags = "p",
},
STEXI
@@ -1841,6 +1842,7 @@ ETEXI
.params = "path property value",
.help = "set QOM property",
.cmd = hmp_qom_set,
+ .flags = "p",
},
STEXI
@@ -1855,6 +1857,7 @@ ETEXI
.help = "show various information about the system state",
.cmd = hmp_info_help,
.sub_table = info_cmds,
+ .flags = "p",
},
STEXI
--
2.17.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v5 6/7] hmp: add exit_preconfig
2018-06-20 15:39 [Qemu-devel] [PATCH v5 0/7] Reenable hmp for preconfig mode Dr. David Alan Gilbert (git)
` (4 preceding siblings ...)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 5/7] hmp: Add commands for preconfig Dr. David Alan Gilbert (git)
@ 2018-06-20 15:39 ` Dr. David Alan Gilbert (git)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 7/7] hmp: Allow HMP in preconfig state again Dr. David Alan Gilbert (git)
6 siblings, 0 replies; 12+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2018-06-20 15:39 UTC (permalink / raw)
To: qemu-devel, armbru, imammedo, peterx
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Add the exit_preconfig command to return to normality.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
---
hmp-commands.hx | 19 +++++++++++++++++++
hmp.c | 8 ++++++++
hmp.h | 1 +
3 files changed, 28 insertions(+)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 4bdf8e2090..b297fe2826 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -55,6 +55,25 @@ STEXI
@item q or quit
@findex quit
Quit the emulator.
+ETEXI
+
+ {
+ .name = "exit_preconfig",
+ .args_type = "",
+ .params = "",
+ .help = "exit the preconfig state",
+ .cmd = hmp_exit_preconfig,
+ .flags = "p",
+ },
+
+STEXI
+@item exit_preconfig
+@findex exit_preconfig
+This command makes QEMU exit the preconfig state and proceed with
+VM initialization using configuration data provided on the command line
+and via the QMP monitor during the preconfig state. The command is only
+available during the preconfig state (i.e. when the --preconfig command
+line option was in use).
ETEXI
{
diff --git a/hmp.c b/hmp.c
index f40d8279cf..f601099f90 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1068,6 +1068,14 @@ void hmp_system_powerdown(Monitor *mon, const QDict *qdict)
qmp_system_powerdown(NULL);
}
+void hmp_exit_preconfig(Monitor *mon, const QDict *qdict)
+{
+ Error *err = NULL;
+
+ qmp_exit_preconfig(&err);
+ hmp_handle_error(mon, &err);
+}
+
void hmp_cpu(Monitor *mon, const QDict *qdict)
{
int64_t cpu_index;
diff --git a/hmp.h b/hmp.h
index 20f27439d3..33354f1bdd 100644
--- a/hmp.h
+++ b/hmp.h
@@ -44,6 +44,7 @@ void hmp_quit(Monitor *mon, const QDict *qdict);
void hmp_stop(Monitor *mon, const QDict *qdict);
void hmp_system_reset(Monitor *mon, const QDict *qdict);
void hmp_system_powerdown(Monitor *mon, const QDict *qdict);
+void hmp_exit_preconfig(Monitor *mon, const QDict *qdict);
void hmp_cpu(Monitor *mon, const QDict *qdict);
void hmp_memsave(Monitor *mon, const QDict *qdict);
void hmp_pmemsave(Monitor *mon, const QDict *qdict);
--
2.17.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v5 7/7] hmp: Allow HMP in preconfig state again
2018-06-20 15:39 [Qemu-devel] [PATCH v5 0/7] Reenable hmp for preconfig mode Dr. David Alan Gilbert (git)
` (5 preceding siblings ...)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 6/7] hmp: add exit_preconfig Dr. David Alan Gilbert (git)
@ 2018-06-20 15:39 ` Dr. David Alan Gilbert (git)
6 siblings, 0 replies; 12+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2018-06-20 15:39 UTC (permalink / raw)
To: qemu-devel, armbru, imammedo, peterx
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Now we can cope with preconfig in HMP, reenable by reverting
commit 71dc578e116599ea73c8a2a4e693134702ec0e83.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
---
monitor.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/monitor.c b/monitor.c
index 0c32308fb2..edf342ac95 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3460,12 +3460,6 @@ static void handle_hmp_command(Monitor *mon, const char *cmdline)
trace_handle_hmp_command(mon, cmdline);
- if (runstate_check(RUN_STATE_PRECONFIG)) {
- monitor_printf(mon, "HMP not available in preconfig state, "
- "use QMP instead\n");
- return;
- }
-
cmd = monitor_parse_command(mon, cmdline, &cmdline, mon->cmd_table);
if (!cmd) {
return;
--
2.17.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v5 4/7] qmp: Enable a few commands in preconfig state
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 4/7] qmp: Enable a few commands in preconfig state Dr. David Alan Gilbert (git)
@ 2018-06-20 18:37 ` Eric Blake
0 siblings, 0 replies; 12+ messages in thread
From: Eric Blake @ 2018-06-20 18:37 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git), qemu-devel, armbru, imammedo,
peterx
On 06/20/2018 10:39 AM, Dr. David Alan Gilbert (git) wrote:
> From: Igor Mammedov <imammedo@redhat.com>
>
> Commands query-chardev, query-version, query-name, query-uuid,
> query-iothreads, query-memdev are informational and do not depend on
> the machine being initialized. Make them available in preconfig
> runstate to make the latter a little bit more useful.
> The generic qom commands don't depend on the machine being initialized
> either; so enabled qom-list, qom-get, qom-set, qom-list-types,
> qom-list-properties.
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> qapi/char.json | 3 ++-
> qapi/misc.json | 27 +++++++++++++++++----------
> 2 files changed, 19 insertions(+), 11 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v5 1/7] hmp: Add flag for preconfig commands
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 1/7] hmp: Add flag for preconfig commands Dr. David Alan Gilbert (git)
@ 2018-06-21 8:44 ` Igor Mammedov
0 siblings, 0 replies; 12+ messages in thread
From: Igor Mammedov @ 2018-06-21 8:44 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git); +Cc: qemu-devel, armbru, peterx
On Wed, 20 Jun 2018 16:39:41 +0100
"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Add a flag to command definitions to allow them to be used in preconfig
> and check it.
> If users try to use commands that aren't available, tell them to use
> the exit_preconfig comand we're adding in a few patches.
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> ---
> monitor.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/monitor.c b/monitor.c
> index 885e000f9b..8dc86c0c3c 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -128,6 +128,7 @@ typedef struct mon_cmd_t {
> const char *args_type;
> const char *params;
> const char *help;
> + const char *flags; /* p=preconfig */
> void (*cmd)(Monitor *mon, const QDict *qdict);
> /* @sub_table is a list of 2nd level of commands. If it does not exist,
> * cmd should be used. If it exists, sub_table[?].cmd should be
> @@ -958,6 +959,19 @@ static int parse_cmdline(const char *cmdline,
> return -1;
> }
>
> +/*
> + * Returns true if the command can be executed in preconfig mode
> + * i.e. it has the 'p' flag.
> + */
> +static bool cmd_can_preconfig(const mon_cmd_t *cmd)
> +{
> + if (!cmd->flags) {
> + return false;
> + }
> +
> + return strchr(cmd->flags, 'p');
> +}
> +
> static void help_cmd_dump_one(Monitor *mon,
> const mon_cmd_t *cmd,
> char **prefix_args,
> @@ -3041,6 +3055,12 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
> (int)(p - cmdp_start), cmdp_start);
> return NULL;
> }
> + if (runstate_check(RUN_STATE_PRECONFIG) && !cmd_can_preconfig(cmd)) {
> + monitor_printf(mon, "Command '%.*s' not available with -preconfig "
> + "until after exit_preconfig.\n",
> + (int)(p - cmdp_start), cmdp_start);
> + return NULL;
> + }
>
> /* filter out following useless space */
> while (qemu_isspace(*p)) {
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v5 5/7] hmp: Add commands for preconfig
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 5/7] hmp: Add commands for preconfig Dr. David Alan Gilbert (git)
@ 2018-06-21 8:56 ` Igor Mammedov
2018-06-21 11:05 ` Dr. David Alan Gilbert
0 siblings, 1 reply; 12+ messages in thread
From: Igor Mammedov @ 2018-06-21 8:56 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git); +Cc: qemu-devel, armbru, peterx
On Wed, 20 Jun 2018 16:39:45 +0100
"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Allow a bunch of the info commands to be used in preconfig.
>
> version, chardev, name, uuid,memdev, iothreads
> Were enabled in QMP in the previous patch from Igor
>
> status, hotpluggable_cpus
> Was enabled in the original allow-preconfig series
>
> history
> is HMP specific
>
> qom-tree, numa
> Don't have a QMP equivalent
I'm not sure that 'info numa' in current state is useful/or valid
at preconfig time wrt memory stats (depends on memory devices
which hasn't created at that moment yet).
Let's drop it for now from this series.
With it dropped:
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> Also enable the qom commands qom-list and qom-set.
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> hmp-commands-info.hx | 11 +++++++++++
> hmp-commands.hx | 3 +++
> 2 files changed, 14 insertions(+)
>
> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> index ddfcd5adcc..874ff07583 100644
> --- a/hmp-commands-info.hx
> +++ b/hmp-commands-info.hx
> @@ -19,6 +19,7 @@ ETEXI
> .params = "",
> .help = "show the version of QEMU",
> .cmd = hmp_info_version,
> + .flags = "p",
> },
>
> STEXI
> @@ -47,6 +48,7 @@ ETEXI
> .params = "",
> .help = "show the character devices",
> .cmd = hmp_info_chardev,
> + .flags = "p",
> },
>
> STEXI
> @@ -165,6 +167,7 @@ ETEXI
> .params = "",
> .help = "show the command line history",
> .cmd = hmp_info_history,
> + .flags = "p",
> },
>
> STEXI
> @@ -315,6 +318,7 @@ ETEXI
> .params = "",
> .help = "show NUMA information",
> .cmd = hmp_info_numa,
> + .flags = "p",
> },
>
> STEXI
> @@ -399,6 +403,7 @@ ETEXI
> .params = "",
> .help = "show the current VM status (running|paused)",
> .cmd = hmp_info_status,
> + .flags = "p",
> },
>
> STEXI
> @@ -457,6 +462,7 @@ ETEXI
> .params = "",
> .help = "show the current VM name",
> .cmd = hmp_info_name,
> + .flags = "p",
> },
>
> STEXI
> @@ -471,6 +477,7 @@ ETEXI
> .params = "",
> .help = "show the current VM UUID",
> .cmd = hmp_info_uuid,
> + .flags = "p",
> },
>
> STEXI
> @@ -613,6 +620,7 @@ ETEXI
> .params = "[path]",
> .help = "show QOM composition tree",
> .cmd = hmp_info_qom_tree,
> + .flags = "p",
> },
>
> STEXI
> @@ -671,6 +679,7 @@ ETEXI
> .params = "",
> .help = "show memory backends",
> .cmd = hmp_info_memdev,
> + .flags = "p",
> },
>
> STEXI
> @@ -699,6 +708,7 @@ ETEXI
> .params = "",
> .help = "show iothreads",
> .cmd = hmp_info_iothreads,
> + .flags = "p",
> },
>
> STEXI
> @@ -829,6 +839,7 @@ ETEXI
> .params = "",
> .help = "Show information about hotpluggable CPUs",
> .cmd = hmp_hotpluggable_cpus,
> + .flags = "p",
> },
>
> STEXI
> diff --git a/hmp-commands.hx b/hmp-commands.hx
> index 3094294e5b..4bdf8e2090 100644
> --- a/hmp-commands.hx
> +++ b/hmp-commands.hx
> @@ -1828,6 +1828,7 @@ ETEXI
> .params = "path",
> .help = "list QOM properties",
> .cmd = hmp_qom_list,
> + .flags = "p",
> },
>
> STEXI
> @@ -1841,6 +1842,7 @@ ETEXI
> .params = "path property value",
> .help = "set QOM property",
> .cmd = hmp_qom_set,
> + .flags = "p",
> },
>
> STEXI
> @@ -1855,6 +1857,7 @@ ETEXI
> .help = "show various information about the system state",
> .cmd = hmp_info_help,
> .sub_table = info_cmds,
> + .flags = "p",
> },
>
> STEXI
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v5 5/7] hmp: Add commands for preconfig
2018-06-21 8:56 ` Igor Mammedov
@ 2018-06-21 11:05 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 12+ messages in thread
From: Dr. David Alan Gilbert @ 2018-06-21 11:05 UTC (permalink / raw)
To: Igor Mammedov; +Cc: qemu-devel, armbru, peterx
* Igor Mammedov (imammedo@redhat.com) wrote:
> On Wed, 20 Jun 2018 16:39:45 +0100
> "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
>
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > Allow a bunch of the info commands to be used in preconfig.
> >
> > version, chardev, name, uuid,memdev, iothreads
> > Were enabled in QMP in the previous patch from Igor
> >
> > status, hotpluggable_cpus
> > Was enabled in the original allow-preconfig series
> >
> > history
> > is HMP specific
> >
> > qom-tree, numa
> > Don't have a QMP equivalent
> I'm not sure that 'info numa' in current state is useful/or valid
> at preconfig time wrt memory stats (depends on memory devices
> which hasn't created at that moment yet).
> Let's drop it for now from this series.
OK, gone.
> With it dropped:
>
> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Thanks.
Dave
> > Also enable the qom commands qom-list and qom-set.
> >
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
> > hmp-commands-info.hx | 11 +++++++++++
> > hmp-commands.hx | 3 +++
> > 2 files changed, 14 insertions(+)
> >
> > diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> > index ddfcd5adcc..874ff07583 100644
> > --- a/hmp-commands-info.hx
> > +++ b/hmp-commands-info.hx
> > @@ -19,6 +19,7 @@ ETEXI
> > .params = "",
> > .help = "show the version of QEMU",
> > .cmd = hmp_info_version,
> > + .flags = "p",
> > },
> >
> > STEXI
> > @@ -47,6 +48,7 @@ ETEXI
> > .params = "",
> > .help = "show the character devices",
> > .cmd = hmp_info_chardev,
> > + .flags = "p",
> > },
> >
> > STEXI
> > @@ -165,6 +167,7 @@ ETEXI
> > .params = "",
> > .help = "show the command line history",
> > .cmd = hmp_info_history,
> > + .flags = "p",
> > },
> >
> > STEXI
> > @@ -315,6 +318,7 @@ ETEXI
> > .params = "",
> > .help = "show NUMA information",
> > .cmd = hmp_info_numa,
> > + .flags = "p",
> > },
> >
> > STEXI
> > @@ -399,6 +403,7 @@ ETEXI
> > .params = "",
> > .help = "show the current VM status (running|paused)",
> > .cmd = hmp_info_status,
> > + .flags = "p",
> > },
> >
> > STEXI
> > @@ -457,6 +462,7 @@ ETEXI
> > .params = "",
> > .help = "show the current VM name",
> > .cmd = hmp_info_name,
> > + .flags = "p",
> > },
> >
> > STEXI
> > @@ -471,6 +477,7 @@ ETEXI
> > .params = "",
> > .help = "show the current VM UUID",
> > .cmd = hmp_info_uuid,
> > + .flags = "p",
> > },
> >
> > STEXI
> > @@ -613,6 +620,7 @@ ETEXI
> > .params = "[path]",
> > .help = "show QOM composition tree",
> > .cmd = hmp_info_qom_tree,
> > + .flags = "p",
> > },
> >
> > STEXI
> > @@ -671,6 +679,7 @@ ETEXI
> > .params = "",
> > .help = "show memory backends",
> > .cmd = hmp_info_memdev,
> > + .flags = "p",
> > },
> >
> > STEXI
> > @@ -699,6 +708,7 @@ ETEXI
> > .params = "",
> > .help = "show iothreads",
> > .cmd = hmp_info_iothreads,
> > + .flags = "p",
> > },
> >
> > STEXI
> > @@ -829,6 +839,7 @@ ETEXI
> > .params = "",
> > .help = "Show information about hotpluggable CPUs",
> > .cmd = hmp_hotpluggable_cpus,
> > + .flags = "p",
> > },
> >
> > STEXI
> > diff --git a/hmp-commands.hx b/hmp-commands.hx
> > index 3094294e5b..4bdf8e2090 100644
> > --- a/hmp-commands.hx
> > +++ b/hmp-commands.hx
> > @@ -1828,6 +1828,7 @@ ETEXI
> > .params = "path",
> > .help = "list QOM properties",
> > .cmd = hmp_qom_list,
> > + .flags = "p",
> > },
> >
> > STEXI
> > @@ -1841,6 +1842,7 @@ ETEXI
> > .params = "path property value",
> > .help = "set QOM property",
> > .cmd = hmp_qom_set,
> > + .flags = "p",
> > },
> >
> > STEXI
> > @@ -1855,6 +1857,7 @@ ETEXI
> > .help = "show various information about the system state",
> > .cmd = hmp_info_help,
> > .sub_table = info_cmds,
> > + .flags = "p",
> > },
> >
> > STEXI
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2018-06-21 11:05 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-20 15:39 [Qemu-devel] [PATCH v5 0/7] Reenable hmp for preconfig mode Dr. David Alan Gilbert (git)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 1/7] hmp: Add flag for preconfig commands Dr. David Alan Gilbert (git)
2018-06-21 8:44 ` Igor Mammedov
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 2/7] hmp: Allow help on " Dr. David Alan Gilbert (git)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 3/7] hmp: Restrict auto-complete in preconfig Dr. David Alan Gilbert (git)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 4/7] qmp: Enable a few commands in preconfig state Dr. David Alan Gilbert (git)
2018-06-20 18:37 ` Eric Blake
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 5/7] hmp: Add commands for preconfig Dr. David Alan Gilbert (git)
2018-06-21 8:56 ` Igor Mammedov
2018-06-21 11:05 ` Dr. David Alan Gilbert
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 6/7] hmp: add exit_preconfig Dr. David Alan Gilbert (git)
2018-06-20 15:39 ` [Qemu-devel] [PATCH v5 7/7] hmp: Allow HMP in preconfig state again Dr. David Alan Gilbert (git)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).