After 'Machine as QOM' series the machine type input triggers
the creation of the machine class.
If the machine type is set in the configuration file, the machine
class is not updated accordingly and remains the default.

Fixed that by querying the machine options after the configuration
file is loaded.

Cc: qemu-sta...@nongnu.org
Reported-by: William Dauchy <will...@gandi.net>
Signed-off-by: Marcel Apfelbaum <mar...@redhat.com>
---
 vl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/vl.c b/vl.c
index 7786b2f..ecd8c93 100644
--- a/vl.c
+++ b/vl.c
@@ -3659,6 +3659,11 @@ int main(int argc, char **argv, char **envp)
                             strerror(-ret));
                         exit(1);
                     }
+                    opts = qemu_get_machine_opts();
+                    optarg = qemu_opt_get(opts, "type");
+                    if (optarg) {
+                        machine_class = machine_parse(optarg);
+                    }
                     break;
                 }
             case QEMU_OPTION_spice:
-- 
2.1.0


Reply via email to