Skip to content

Commit b316937

Browse files
marcel-apfmdroth
authored andcommitted
vl.c: fix regression when reading machine type from config file
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: [email protected] Reported-by: William Dauchy <[email protected]> Signed-off-by: Marcel Apfelbaum <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> (cherry picked from commit 364c3e6) Signed-off-by: Michael Roth <[email protected]>
1 parent 5b5c7bf commit b316937

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

vl.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3052,9 +3052,6 @@ int main(int argc, char **argv, char **envp)
30523052
exit(1);
30533053
}
30543054
switch(popt->index) {
3055-
case QEMU_OPTION_M:
3056-
machine_class = machine_parse(optarg);
3057-
break;
30583055
case QEMU_OPTION_no_kvm_irqchip: {
30593056
olist = qemu_find_opts("machine");
30603057
qemu_opts_parse(olist, "kernel_irqchip=off", 0);
@@ -3672,16 +3669,13 @@ int main(int argc, char **argv, char **envp)
36723669
olist = qemu_find_opts("machine");
36733670
qemu_opts_parse(olist, "accel=kvm", 0);
36743671
break;
3672+
case QEMU_OPTION_M:
36753673
case QEMU_OPTION_machine:
36763674
olist = qemu_find_opts("machine");
36773675
opts = qemu_opts_parse(olist, optarg, 1);
36783676
if (!opts) {
36793677
exit(1);
36803678
}
3681-
optarg = qemu_opt_get(opts, "type");
3682-
if (optarg) {
3683-
machine_class = machine_parse(optarg);
3684-
}
36853679
break;
36863680
case QEMU_OPTION_no_kvm:
36873681
olist = qemu_find_opts("machine");
@@ -3964,6 +3958,13 @@ int main(int argc, char **argv, char **envp)
39643958
}
39653959
}
39663960
}
3961+
3962+
opts = qemu_get_machine_opts();
3963+
optarg = qemu_opt_get(opts, "type");
3964+
if (optarg) {
3965+
machine_class = machine_parse(optarg);
3966+
}
3967+
39673968
loc_set_none();
39683969

39693970
os_daemonize();

0 commit comments

Comments
 (0)