aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Apfelbaum <marcel.a@redhat.com>2014-12-10 15:19:30 +0200
committerGreg Bellows <greg.bellows@linaro.org>2014-12-12 13:58:48 -0600
commite580407248c53aa9d80f45beae9728faaa352e23 (patch)
treead43364e1f263eee776df25b6636e1712446e472
parent75b47c5464e982df5ff31ac15a25cf0eb281e40c (diff)
vl.c: add HMP help to machine
The help is based on the actual machine properties exposing only the relevant options. Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> Message-id: 1418217570-15517-4-git-send-email-marcel.a@redhat.com
-rw-r--r--vl.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index 7a5800033..24d91b395 100644
--- a/vl.c
+++ b/vl.c
@@ -1485,6 +1485,31 @@ MachineInfoList *qmp_query_machines(Error **errp)
return mach_list;
}
+static int machine_help_func(QemuOpts *opts, MachineState *machine)
+{
+ ObjectProperty *prop;
+
+ if (!qemu_opt_has_help_opt(opts)) {
+ return 0;
+ }
+
+ QTAILQ_FOREACH(prop, &OBJECT(machine)->properties, node) {
+ if (!prop->set) {
+ continue;
+ }
+
+ error_printf("%s.%s=%s", MACHINE_GET_CLASS(machine)->name,
+ prop->name, prop->type);
+ if (prop->description) {
+ error_printf(" (%s)\n", prop->description);
+ } else {
+ error_printf("\n");
+ }
+ }
+
+ return 1;
+}
+
/***********************************************************/
/* main execution loop */
@@ -3820,6 +3845,9 @@ int main(int argc, char **argv, char **envp)
current_machine = MACHINE(object_new(object_class_get_name(
OBJECT_CLASS(machine_class))));
+ if (machine_help_func(qemu_get_machine_opts(), current_machine)) {
+ exit(0);
+ }
object_property_add_child(object_get_root(), "machine",
OBJECT(current_machine), &error_abort);
cpu_exec_init_all();