[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/64] vl: plug -object back into -readconfig
From: |
Michael Roth |
Subject: |
[PATCH 14/64] vl: plug -object back into -readconfig |
Date: |
Tue, 19 Oct 2021 09:08:54 -0500 |
From: Paolo Bonzini <pbonzini@redhat.com>
Commit bc2f4fcb1d ("qom: move user_creatable_add_opts logic to vl.c
and QAPIfy it", 2021-03-19) switched the creation of objects from
qemu_opts_foreach to a bespoke QTAILQ in preparation for supporting JSON
syntax in -object.
Unfortunately in doing so it lost support for [object] stanzas in
configuration files and also for "-set object.ID.KEY=VAL". The latter
is hard to re-establish and probably best solved by deprecating -set.
This patch uses the infrastructure introduced by the previous two
patches in order to parse QOM objects correctly from configuration
files.
Cc: Markus Armbruster <armbru@redhat.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210524105752.3318299-4-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 49e987695a1873a769a823604f9065aa88e00c55)
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
softmmu/vl.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 8f18f506d9..6be510b035 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -1709,9 +1709,15 @@ static void object_option_foreach_add(bool
(*type_opt_predicate)(const char *))
}
}
+static void object_option_add_visitor(Visitor *v)
+{
+ ObjectOption *opt = g_new0(ObjectOption, 1);
+ visit_type_ObjectOptions(v, NULL, &opt->opts, &error_fatal);
+ QTAILQ_INSERT_TAIL(&object_opts, opt, next);
+}
+
static void object_option_parse(const char *optarg)
{
- ObjectOption *opt;
QemuOpts *opts;
const char *type;
Visitor *v;
@@ -1739,11 +1745,8 @@ static void object_option_parse(const char *optarg)
v = opts_visitor_new(opts);
}
- opt = g_new0(ObjectOption, 1);
- visit_type_ObjectOptions(v, NULL, &opt->opts, &error_fatal);
+ object_option_add_visitor(v);
visit_free(v);
-
- QTAILQ_INSERT_TAIL(&object_opts, opt, next);
}
/*
@@ -2120,13 +2123,22 @@ static int global_init_func(void *opaque, QemuOpts
*opts, Error **errp)
*/
static bool is_qemuopts_group(const char *group)
{
+ if (g_str_equal(group, "object")) {
+ return false;
+ }
return true;
}
static void qemu_record_config_group(const char *group, QDict *dict,
bool from_json, Error **errp)
{
- abort();
+ if (g_str_equal(group, "object")) {
+ Visitor *v = qobject_input_visitor_new_keyval(QOBJECT(dict));
+ object_option_add_visitor(v);
+ visit_free(v);
+ } else {
+ abort();
+ }
}
/*
--
2.25.1
- [PATCH 00/64] Patch Round-up for stable 6.0.1, freeze on 2021-10-26, Michael Roth, 2021/10/19
- [PATCH 09/64] target/xtensa: fix access ring in l32ex, Michael Roth, 2021/10/19
- [PATCH 10/64] qemu-option: support accept-any QemuOptsList in qemu_opts_absorb_qdict, Michael Roth, 2021/10/19
- [PATCH 11/64] qemu-config: load modules when instantiating option groups, Michael Roth, 2021/10/19
- [PATCH 12/64] qemu-config: parse configuration files to a QDict, Michael Roth, 2021/10/19
- [PATCH 13/64] vl: plumb keyval-based options into -readconfig, Michael Roth, 2021/10/19
- [PATCH 14/64] vl: plug -object back into -readconfig,
Michael Roth <=
- [PATCH 15/64] sockets: update SOCKET_ADDRESS_TYPE_FD listen(2) backlog, Michael Roth, 2021/10/19
- [PATCH 16/64] hmp: Fix loadvm to resume the VM on success instead of failure, Michael Roth, 2021/10/19
- [PATCH 17/64] configure: fix detection of gdbus-codegen, Michael Roth, 2021/10/19
- [PATCH 18/64] vhost-vdpa: don't initialize backend_features, Michael Roth, 2021/10/19
- [PATCH 19/64] esp: only assert INTR_DC interrupt flag if selection fails, Michael Roth, 2021/10/19
- [PATCH 20/64] esp: only set ESP_RSEQ at the start of the select sequence, Michael Roth, 2021/10/19
- [PATCH 01/64] multi-process: Initialize variables declared with g_auto*, Michael Roth, 2021/10/19
- [PATCH 21/64] runstate: Initialize Error * to NULL, Michael Roth, 2021/10/19
- [PATCH 22/64] vfio: Fix unregister SaveVMHandler in vfio_migration_finalize, Michael Roth, 2021/10/19
- [PATCH 23/64] vl: Fix an assert failure in error path, Michael Roth, 2021/10/19