aboutsummaryrefslogtreecommitdiff
path: root/softmmu/vl.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2021-05-18 09:08:17 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2021-05-26 14:49:46 +0200
commit632a8873500d27022c584256afc11e57e2418b94 (patch)
tree548d46f948fe6082c9477e0980578bee15afe83e /softmmu/vl.c
parentd349f92f78d26db2805ca39a7745cc70affea021 (diff)
qemu-config: load modules when instantiating option groups
Right now the SPICE module is special cased to be loaded when processing of the -spice command line option. However, the spice option group can also be brought in via -readconfig, in which case the module is not loaded. Add a generic hook to load modules that provide a QemuOpts group, and use it for the "spice" and "iscsi" groups. Fixes: #194 Fixes: https://bugs.launchpad.net/qemu/+bug/1910696 Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'softmmu/vl.c')
-rw-r--r--softmmu/vl.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 21e55718a6..6054f6f0b9 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2627,6 +2627,23 @@ void qmp_x_exit_preconfig(Error **errp)
}
}
+#ifdef CONFIG_MODULES
+void qemu_load_module_for_opts(const char *group)
+{
+ static bool spice_tried;
+ if (g_str_equal(group, "spice") && !spice_tried) {
+ ui_module_load_one("spice-core");
+ spice_tried = true;
+ }
+
+ static bool iscsi_tried;
+ if (g_str_equal(group, "iscsi") && !iscsi_tried) {
+ block_module_load_one("iscsi");
+ iscsi_tried = true;
+ }
+}
+#endif
+
void qemu_init(int argc, char **argv, char **envp)
{
QemuOpts *opts;
@@ -3387,10 +3404,6 @@ void qemu_init(int argc, char **argv, char **envp)
case QEMU_OPTION_spice:
olist = qemu_find_opts_err("spice", NULL);
if (!olist) {
- ui_module_load_one("spice-core");
- olist = qemu_find_opts("spice");
- }
- if (!olist) {
error_report("spice support is disabled");
exit(1);
}