vl.c: fix regression when reading machine type from config file
PATCH 1/1 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.
--- vl.c | 5 +++++ 1 file changed, 5 insertions(+)
vl.c +5 -0
@@ -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:
Signature · 1 line
2.1.0
Quoted 22 lines · Marcel Apfelbaum
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.
Reported-by William Dauchy <[email protected]>Signed-off-by Marcel Apfelbaum <[email protected]>--- vl.c | 5 +++++ 1 file changed, 5 insertions(+)vl.c +0
-0@@ -3659,6 +3659,11 @@ int main(int argc, char **argv, char **envp) strerror(-ret));
vl.c int main(int argc, char **argv, char **envp) · line 3669
Quoted 10 lines
vl.c +5
-0exit (1 ); } + opts =qemu_get_machine_opts (); + optarg =qemu_opt_get (opts,"type" ); +if (optarg) { + machine_class =machine_parse (optarg); + }break ; }case QEMU_OPTION_spice:
This suggests that these five lines should be moved after the switch, and "-M" should become simply a synonym of "-machine" (that's the other place where we invoke machine_parse).
Paolo
Quoted 31 lines · Paolo Bonzini
Quoted 28 lines · Marcel Apfelbaum
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.
Reported-by William Dauchy <[email protected]>Signed-off-by Marcel Apfelbaum <[email protected]>--- vl.c | 5 +++++ 1 file changed, 5 insertions(+)vl.c +5
-0@@ -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); + }
Quoted 8 lines
vl.c int main(int argc, char **argv, char **envp) · line 3669
Quoted 4 lines
vl.c +0
-0break ; }case QEMU_OPTION_spice:This suggests that these five lines should be moved after the switch, and "-M" should become simply a synonym of "-machine" (that's the other place where we invoke
machine_parse).
Hi Paolo,
Thanks for the review.
It makes sense. I will change this and submit again.
Thanks,
Marcel
Quoted 3 lines
Paolo