convert many options to QemuOpts
cover convert many options to QemuOpts
This converts a lot of commonly-used options to QemuOpts. Most of them get in -machine, but I don't intend -machine to become a catch-all option. In fact I refrained from converting those that should go in -display (like -keyboard) or should be moved to enum device properties.
With the exception of -display, now a more-or-less complete PC machine can be created from config. This is unfortunately not true of most embedded machines which use arrays such as serial_hd to create devices and do not support using -device instead.
This does not mean that all options can be used. Only -monitor and -qmp create a backend/frontend pair in QemuOpts, so things such as -serial stdio will not work.
Patch 1 is a bugfix, it was already submitted and informally approved by Blue.
Paolo Bonzini (12):
vga: disable default VGA if appropriate -device is used
QemuOpts: use strtosz
cmdline: implement -m with QemuOpts
cmdline: implement -S with QemuOpts
cmdline: implement -bios with QemuOpts
cmdline: implement -localtime with QemuOpts
cmdline: make -M a simple alias for -machine type
cmdline: convert -smp to QemuOpts
cmdline: reindent numa_add
cmdline: convert -numa to QemuOpts
cmdline: implement -nodefaults with qemuopts
cmdline: convert -no-shutdown and -no-reboot to QemuOpts
qemu-config.c | 78 +++++++++++++++ qemu-option.c | 41 ++------ vl.c | 289 ++++++++++++++++++++++++++----------------------------- 3 files changed, 225 insertions(+), 183 deletions(-)
Signature · 1 line
1.7.7.6
PATCH 1/12 vga: disable default VGA if appropriate -device is used
This is a partial revert of commits a369da5 (vga: improve VGA logic, committed 2012-01-22) and c5bd4f3 (vga: fix -nodefaults -device VGA, 2012-01-24) which broke command-line option parsing in different ways.
Since commit a369da5 it has become impossible to specify a VGA device entirely with QemuOpts-enabled options, i.e. without needing an explicit "-vga none".
In addition, until commit c5bd4f3 -nodefaults would not disable the device you specified with the legacy "-vga" option, independent of the order. Since commit c5bd4f3 QEMU -nodefaults will override a previous -vga option.
I did not reintroduce machine->no_vga. Boards can simply ignore the vga_interface_type variable, and most will indeed do so.
--- vl.c | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-)
vl.c +16 -9
@@ -272,6 +272,7 @@ static int default_monitor = 1;static int default_floppy =1 ;static int default_cdrom =1 ;static int default_sdcard =1 ; +static int default_vga =1 ; static struct { const char *driver;
@@ -287,6 +288,12 @@ static struct { { .driver = "virtio-serial-pci", .flag = &default_virtcon }, { .driver = "virtio-serial-s390", .flag = &default_virtcon }, { .driver = "virtio-serial", .flag = &default_virtcon }, + { .driver = "VGA", .flag = &default_vga }, + { .driver = "isa-vga", .flag = &default_vga }, + { .driver = "cirrus-vga", .flag = &default_vga }, + { .driver = "isa-cirrus-vga", .flag = &default_vga }, + { .driver = "vmware-svga", .flag = &default_vga }, + { .driver = "qxl-vga", .flag = &default_vga }, };static void res_free (void )
@@ -2269,7 +2276,7 @@ int main(int argc, char **argv, char **envp)const char *loadvm =NULL ;QEMUMachine *machine;const char *cpu_model; -const char *vga_model =NULL ; +const char *vga_model ="none" ;const char *pid_file =NULL ;const char *incoming =NULL ;#ifdef CONFIG_VNC
@@ -2699,6 +2706,7 @@ int main(int argc, char **argv, char **envp)break ;case QEMU_OPTION_vga: vga_model = optarg; + default_vga =0 ;break ;case QEMU_OPTION_g: {
@@ -3107,7 +3115,7 @@ int main(int argc, char **argv, char **envp) default_floppy =0 ; default_cdrom =0 ; default_sdcard =0 ; - vga_model ="none" ; + default_vga =0 ;break ;case QEMU_OPTION_xen_domid:if (!(xen_available ())) {
@@ -3468,14 +3476,13 @@ int main(int argc, char **argv, char **envp)module_call_init (MODULE_INIT_QOM ); -/* must be after qdev registration but before machine init */ -if (vga_model) { -select_vgahw (vga_model); - }else if (cirrus_vga_available ()) { -select_vgahw ("cirrus" ); - }else { -select_vgahw ("none" ); +/* This must be after qdev registration but before machine init. +* If no default VGA is requested, the default is "none". +*/ +if (default_vga &&cirrus_vga_available ()) { + vga_model ="cirrus" ; } +select_vgahw (vga_model);if (qemu_opts_foreach (qemu_find_opts ("device" ), device_help_func,NULL ,0 ) !=0 )exit (0 );
Signature · 1 line
1.7.7.6
PATCH 2/12 QemuOpts: use strtosz
In reply to Paolo BonziniThis will simplify conversion of -numa node,mem=... and -m to QemuOpts.
--- qemu-option.c | 41 ++++++++++------------------------------- 1 files changed, 10 insertions(+), 31 deletions(-)
qemu-option.c +10 -31
@@ -204,41 +204,20 @@ static int parse_option_number(const char *name, const char *value, uint64_t *rereturn 0 ; } -static int parse_option_size (const char *name,const char *value,uint64_t *ret) +static int parse_option_size (const char *name,const char *value, +const char default_suffix,uint64_t *ret) {char *postfix; -double sizef; +int64_t size; -if (value !=NULL ) { - sizef =strtod (value, &postfix); -switch (*postfix) { -case 'T' : - sizef *=1024 ; -/* fall through */ -case 'G' : - sizef *=1024 ; -/* fall through */ -case 'M' : - sizef *=1024 ; -/* fall through */ -case 'K' : -case 'k' : - sizef *=1024 ; -/* fall through */ -case 'b' : -case '\0' : - *ret = (uint64_t ) sizef; -break ; -default : -qerror_report (QERR_INVALID_PARAMETER_VALUE , name,"a size" ); -error_printf_unless_qmp ("You may use k, M, G or T suffixes for " -"kilobytes, megabytes, gigabytes and terabytes.\n" ); -return -1 ; - } - }else { + size =strtosz_suffix (value, &postfix, default_suffix); +if (size <0 || *postfix) {qerror_report (QERR_INVALID_PARAMETER_VALUE , name,"a size" ); +error_printf_unless_qmp ("You may use k, M, G or T suffixes for " +"kilobytes, megabytes, gigabytes and terabytes.\n" );return -1 ; } + *ret = size;return 0 ; }
@@ -289,7 +268,7 @@ int set_option_parameter(QEMUOptionParameter *list, const char *name,break ;case OPT_SIZE : -if (parse_option_size (name, value, &list->value.n) ==-1 ) +if (parse_option_size (name, value,'B' , &list->value.n) ==-1 )return -1 ;break ;
@@ -589,7 +568,7 @@ static int qemu_opt_parse(QemuOpt *opt)case QEMU_OPT_NUMBER :return parse_option_number (opt->name, opt->str, &opt->value.uint);case QEMU_OPT_SIZE : -return parse_option_size (opt->name, opt->str, &opt->value.uint); +return parse_option_size (opt->name, opt->str,'M' , &opt->value.uint);default :abort (); }
Signature · 1 line
1.7.7.6
PATCH 3/12 cmdline: implement -m with QemuOpts
In reply to Paolo BonziniThis becomes -machine ram_size.
--- qemu-config.c | 4 ++++ vl.c | 41 ++++++++++++----------------------------- 2 files changed, 16 insertions(+), 29 deletions(-)
qemu-config.c +4 -0
@@ -582,6 +582,10 @@ static QemuOptsList qemu_machine_opts = { .name = "dtb", .type = QEMU_OPT_STRING, .help = "Linux kernel device tree file", + }, { + .name = "ram_size", + .type = QEMU_OPT_SIZE, + .help = "RAM size", }, {/* End of list */ } },
vl.c +12 -29
64 lines not on this page · raw message
Signature · 1 line
1.7.7.6
PATCH 4/12 cmdline: implement -S with QemuOpts
In reply to Paolo BonziniThis becomes -machine autostart.
--- qemu-config.c | 4 ++++ vl.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletions(-)
qemu-config.c +4 -0
@@ -559,6 +559,10 @@ static QemuOptsList qemu_machine_opts = { .type = QEMU_OPT_STRING, .help = "accelerator list", }, { + .name = "autostart", + .type = QEMU_OPT_BOOL, + .help = "start machine immediately", + }, { .name = "kernel_irqchip", .type = QEMU_OPT_BOOL, .help = "use KVM in-kernel irqchip",
vl.c +2 -1
@@ -2683,7 +2683,7 @@ int main(int argc, char **argv, char **envp) singlestep =1 ;break ;case QEMU_OPTION_S : - autostart =0 ; +qemu_opts_set (qemu_find_opts ("machine" ),0 ,"autostart" ,"off" );break ;case QEMU_OPTION_k: keyboard_layout = optarg;
@@ -3316,6 +3316,7 @@ int main(int argc, char **argv, char **envp) kernel_filename = initrd_filename = kernel_cmdline =NULL ; ram_size =DEFAULT_RAM_SIZE *1024 *1024 ;if (machine_opts) { + autostart =qemu_opt_get_bool (machine_opts,"autostart" , true); ram_size =qemu_opt_get_size (machine_opts,"ram_size" , ram_size); kernel_filename =qemu_opt_get (machine_opts,"kernel" ); initrd_filename =qemu_opt_get (machine_opts,"initrd" );
Signature · 1 line
1.7.7.6
PATCH 5/12 cmdline: implement -bios with QemuOpts
In reply to Paolo BonziniThis becomes -machine bios.
--- qemu-config.c | 4 ++++ vl.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletions(-)
qemu-config.c +4 -0
@@ -563,6 +563,10 @@ static QemuOptsList qemu_machine_opts = { .type = QEMU_OPT_BOOL, .help = "start machine immediately", }, { + .name = "bios", + .type = QEMU_OPT_STRING, + .help = "BIOS/firmware file", + }, { .name = "kernel_irqchip", .type = QEMU_OPT_BOOL, .help = "use KVM in-kernel irqchip",
vl.c +3 -1
@@ -2677,7 +2677,7 @@ int main(int argc, char **argv, char **envp) data_dir = optarg;break ;case QEMU_OPTION_bios: - bios_name = optarg; +qemu_opts_set (qemu_find_opts ("machine" ),0 ,"bios" , optarg);break ;case QEMU_OPTION_singlestep: singlestep =1 ;
@@ -3313,10 +3313,12 @@ int main(int argc, char **argv, char **envp) } machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); + bios_name =NULL ; kernel_filename = initrd_filename = kernel_cmdline =NULL ; ram_size =DEFAULT_RAM_SIZE *1024 *1024 ;if (machine_opts) { autostart =qemu_opt_get_bool (machine_opts,"autostart" , true); + bios_name =qemu_opt_get (machine_opts,"bios" ); ram_size =qemu_opt_get_size (machine_opts,"ram_size" , ram_size); kernel_filename =qemu_opt_get (machine_opts,"kernel" ); initrd_filename =qemu_opt_get (machine_opts,"initrd" );
Signature · 1 line
1.7.7.6
PATCH 6/12 cmdline: implement -localtime with QemuOpts
In reply to Paolo BonziniThe -localtime option already has a QemuOpts equivalent. Setting the merge_lists option on the -rtc list makes it simple to use it.
This includes a small change in behavior for -rtc. For example, "-rtc base=localtime -rtc driftfix=slew" will actually combine the option rather than override them. These are actually nicer semantics than what was there so far.
--- qemu-config.c | 1 + vl.c | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)
qemu-config.c +1 -0
@@ -327,6 +327,7 @@ static QemuOptsList qemu_net_opts = {static QemuOptsList qemu_rtc_opts = { .name ="rtc" , + .merge_lists = true, .head =QTAILQ_HEAD_INITIALIZER (qemu_rtc_opts.head), .desc = { {
vl.c +1 -1
@@ -2689,7 +2689,7 @@ int main(int argc, char **argv, char **envp) keyboard_layout = optarg;break ;case QEMU_OPTION_localtime: - rtc_utc =0 ; +qemu_opts_parse (qemu_find_opts ("rtc" ),"base=localtime" ,0 );break ;case QEMU_OPTION_vga: vga_model = optarg;
Signature · 1 line
1.7.7.6
PATCH 7/12 cmdline: make -M a simple alias for -machine type
In reply to Paolo Bonzinimachine_parse is still being called from the -M handler. Remove this, and just call machine_parse based on the "-machine type" value.
--- vl.c | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-)
vl.c +14 -13
@@ -2274,7 +2274,7 @@ int main(int argc, char **argv, char **envp)int optind;const char *optarg;const char *loadvm =NULL ; -QEMUMachine *machine; +QEMUMachine *machine =NULL ;const char *cpu_model;const char *vga_model ="none" ;const char *pid_file =NULL ;
@@ -2317,7 +2317,6 @@ int main(int argc, char **argv, char **envp)os_setup_early_signal_handling ();module_call_init (MODULE_INIT_MACHINE ); - machine =find_default_machine (); cpu_model =NULL ; ram_size =0 ; snapshot =0 ;
@@ -2384,7 +2383,7 @@ int main(int argc, char **argv, char **envp) }switch (popt->index) {case QEMU_OPTION_M : - machine =machine_parse (optarg); +qemu_opts_set (qemu_find_opts ("machine" ),0 ,"type" , optarg);break ;case QEMU_OPTION_cpu:/* hw initialization will check this */
@@ -2954,10 +2953,6 @@ int main(int argc, char **argv, char **envp)fprintf (stderr,"parse error: %s\n" , optarg);exit (1 ); } - optarg =qemu_opt_get (opts,"type" ); -if (optarg) { - machine =machine_parse (optarg); - }break ;case QEMU_OPTION_usb: usb_enabled =1 ;
@@ -3218,11 +3213,19 @@ int main(int argc, char **argv, char **envp) data_dir =CONFIG_QEMU_DATADIR ; } -if (machine ==NULL ) { -fprintf (stderr,"No machine found.\n" ); -exit (1 ); + machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); +if (machine_opts) { + optarg =qemu_opt_get (machine_opts,"type" ); +if (optarg) { + machine =machine_parse (optarg); + } + } +if (!machine) { + machine =find_default_machine (); } + current_machine = machine; +/* * Default to max_cpus = smp_cpus, in case the user doesn't * specify a max_cpus value.
@@ -3312,7 +3315,7 @@ int main(int argc, char **argv, char **envp)exit (1 ); } - machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); +/* Initialize machine options */ bios_name =NULL ; kernel_filename = initrd_filename = kernel_cmdline =NULL ; ram_size =DEFAULT_RAM_SIZE *1024 *1024 ;
@@ -3493,8 +3496,6 @@ int main(int argc, char **argv, char **envp)set_numa_modes (); - current_machine = machine; -/* init USB devices */ if (usb_enabled) {if (foreach_device_config (DEV_USB , usb_parse) <0 )
Signature · 1 line
1.7.7.6
PATCH 8/12 cmdline: convert -smp to QemuOpts
In reply to Paolo BonziniThis introduces a new option group, but it is mostly trivial.
--- qemu-config.c | 31 +++++++++++++++++++++++++++++ vl.c | 61 +++++++++++++++++++++++++------------------------------- 2 files changed, 58 insertions(+), 34 deletions(-)
qemu-config.c +31 -0
@@ -600,6 +600,36 @@ static QemuOptsList qemu_machine_opts = { }, }; +QemuOptsList qemu_smp_opts = { + .name ="smp" , + .head =QTAILQ_HEAD_INITIALIZER (qemu_smp_opts.head), + .implied_opt_name ="cpus" , + .desc = { + { + .name ="cpus" , + .type =QEMU_OPT_NUMBER , + .help ="Number of CPUs" , + }, { + .name ="sockets" , + .type =QEMU_OPT_NUMBER , + .help ="Number of sockets" , + }, { + .name ="cores" , + .type =QEMU_OPT_NUMBER , + .help ="Number of cores per socket" , + }, { + .name ="threads" , + .type =QEMU_OPT_NUMBER , + .help ="Number of simultaneous threads per core" , + }, { + .name ="maxcpus" , + .type =QEMU_OPT_NUMBER , + .help ="Maximum number of pluggable CPUs" , + }, + {/*End of list */ } + }, +}; +QemuOptsList qemu_boot_opts = { .name ="boot-opts" , .head =QTAILQ_HEAD_INITIALIZER (qemu_boot_opts.head),
@@ -639,6 +669,7 @@ static QemuOptsList *vm_config_groups[32] = { &qemu_trace_opts, &qemu_option_rom_opts, &qemu_machine_opts, + &qemu_smp_opts, &qemu_boot_opts, &qemu_iscsi_opts, NULL,
vl.c +27 -34
90 lines not on this page · raw message
Signature · 1 line
1.7.7.6
PATCH 9/12 cmdline: reindent numa_add
In reply to Paolo Bonzini--- vl.c | 72 +++++++++++++++++++++++++++++++++--------------------------------- 1 files changed, 36 insertions(+), 36 deletions(-)
vl.c +36 -36
@@ -950,49 +950,49 @@ static void numa_add(const char *optarg)int nodenr; optarg =get_opt_name (option,128 , optarg,',' ) +1 ; -if (!strcmp (option,"node" )) { -if (get_param_value (option,128 ,"nodeid" , optarg) ==0 ) { - nodenr = nb_numa_nodes; - }else { - nodenr =strtoull (option,NULL ,10 ); - } +if (strcmp (option,"node" )) { +return ; + } +if (get_param_value (option,128 ,"nodeid" , optarg) ==0 ) { + nodenr = nb_numa_nodes; + }else { + nodenr =strtoull (option,NULL ,10 ); + } -if (get_param_value (option,128 ,"mem" , optarg) ==0 ) { - node_mem[nodenr] =0 ; - }else { -int64_t sval; - sval =strtosz (option, &endptr); -if (sval <0 || *endptr) { -fprintf (stderr,"qemu: invalid numa mem size: %s\n" , optarg); -exit (1 ); - } - node_mem[nodenr] = sval; +if (get_param_value (option,128 ,"mem" , optarg) ==0 ) { + node_mem[nodenr] =0 ; + }else { +int64_t sval; + sval =strtosz (option, &endptr); +if (sval <0 || *endptr) { +fprintf (stderr,"qemu: invalid numa mem size: %s\n" , optarg); +exit (1 ); } -if (get_param_value (option,128 ,"cpus" , optarg) ==0 ) { - node_cpumask[nodenr] =0 ; + node_mem[nodenr] = sval; + } +if (get_param_value (option,128 ,"cpus" , optarg) ==0 ) { + node_cpumask[nodenr] =0 ; + }else { + value =strtoull (option, &endptr,10 ); +if (value >=64 ) { + value =63 ; +fprintf (stderr,"only 64 CPUs in NUMA mode supported.\n" ); }else { - value =strtoull (option, &endptr,10 ); -if (value >=64 ) { - value =63 ; -fprintf (stderr,"only 64 CPUs in NUMA mode supported.\n" ); - }else { -if (*endptr =='-' ) { - endvalue =strtoull (endptr+1 , &endptr,10 ); -if (endvalue >=63 ) { - endvalue =62 ; -fprintf (stderr, -"only 63 CPUs in NUMA mode supported.\n" ); - } - value = (2ULL << endvalue) - (1ULL << value); - }else { - value =1ULL << value; +if (*endptr =='-' ) { + endvalue =strtoull (endptr+1 , &endptr,10 ); +if (endvalue >=63 ) { + endvalue =62 ; +fprintf (stderr, +"only 63 CPUs in NUMA mode supported.\n" ); } + value = (2ULL << endvalue) - (1ULL << value); + }else { + value =1ULL << value; } - node_cpumask[nodenr] = value; } - nb_numa_nodes++; + node_cpumask[nodenr] = value; } -return ; + nb_numa_nodes++; }static int smp_init_func (QemuOpts *opts,void *opaque)
Signature · 1 line
1.7.7.6
PATCH 10/12 cmdline: convert -numa to QemuOpts
In reply to Paolo BonziniThis requires some special casing to skip the fake "node" option and to handle the automatic "-numa node" syntax. Besides this, the option parsing maps easily to QemuOpts.
--- qemu-config.c | 22 ++++++++++++++++++++++ vl.c | 50 +++++++++++++++++++++++++------------------------- 2 files changed, 47 insertions(+), 25 deletions(-)
qemu-config.c +22 -0
@@ -630,6 +630,27 @@ QemuOptsList qemu_smp_opts = { }, }; +QemuOptsList qemu_numa_opts = { + .name ="numa" , + .head =QTAILQ_HEAD_INITIALIZER (qemu_numa_opts.head), + .desc = { + { + .name ="nodeid" , + .type =QEMU_OPT_NUMBER , + .help ="Numeric identifier for the node" , + }, { + .name ="mem" , + .type =QEMU_OPT_SIZE , + .help ="Amount of memory for this node" , + }, { + .name ="cpus" , + .type =QEMU_OPT_STRING , + .help ="Identifier or range of identifiers for CPUs in this node" , + }, + {/*End of list */ } + }, +}; +QemuOptsList qemu_boot_opts = { .name ="boot-opts" , .head =QTAILQ_HEAD_INITIALIZER (qemu_boot_opts.head),
@@ -670,6 +691,7 @@ static QemuOptsList *vm_config_groups[32] = { &qemu_option_rom_opts, &qemu_machine_opts, &qemu_smp_opts, + &qemu_numa_opts, &qemu_boot_opts, &qemu_iscsi_opts, NULL,
vl.c +25 -25
91 lines not on this page · raw message
Signature · 1 line
1.7.7.6
PATCH 11/12 cmdline: implement -nodefaults with qemuopts
In reply to Paolo BonziniThis becomes -machine default_devices.
--- qemu-config.c | 4 ++++ vl.c | 40 ++++++++++++++++++---------------------- 2 files changed, 22 insertions(+), 22 deletions(-)
qemu-config.c +4 -0
@@ -560,6 +560,10 @@ static QemuOptsList qemu_machine_opts = { .type = QEMU_OPT_STRING, .help = "accelerator list", }, { + .name = "default_devices", + .type = QEMU_OPT_BOOL, + .help = "create default devices", + }, { .name = "autostart", .type = QEMU_OPT_BOOL, .help = "start machine immediately",
vl.c +18 -22
@@ -3075,15 +3075,7 @@ int main(int argc, char **argv, char **envp) incoming = optarg;break ;case QEMU_OPTION_nodefaults: - default_serial =0 ; - default_parallel =0 ; - default_virtcon =0 ; - default_monitor =0 ; - default_net =0 ; - default_floppy =0 ; - default_cdrom =0 ; - default_sdcard =0 ; - default_vga =0 ; +qemu_opts_set (qemu_find_opts ("machine" ),0 ,"default_devices" ,"off" );break ;case QEMU_OPTION_xen_domid:if (!(xen_available ())) {
@@ -3243,26 +3235,30 @@ int main(int argc, char **argv, char **envp) machine->default_machine_opts, 0); } -qemu_opts_foreach (qemu_find_opts ("device" ), default_driver_check,NULL ,0 ); -qemu_opts_foreach (qemu_find_opts ("global" ), default_driver_check,NULL ,0 ); +if (qemu_opt_get_bool (machine_opts,"default_devices" , true)) { +qemu_opts_foreach (qemu_find_opts ("device" ), default_driver_check,NULL ,0 ); +qemu_opts_foreach (qemu_find_opts ("global" ), default_driver_check,NULL ,0 ); + + default_serial &= !machine->no_serial; + default_parallel &= !machine->no_parallel; + default_virtcon &= machine->use_virtcon; + default_floppy &= !machine->no_floppy; + default_cdrom &= !machine->no_cdrom; + default_sdcard &= !machine->no_sdcard; -if (machine->no_serial) { +/* No need for machine->no_vga. Boards can simply ignore the +* vga_interface_type variable (most will, indeed). +*/ + }else { default_serial =0 ; - } -if (machine->no_parallel) { default_parallel =0 ; - } -if (!machine->use_virtcon) { default_virtcon =0 ; - } -if (machine->no_floppy) { + default_monitor =0 ; + default_net =0 ; default_floppy =0 ; - } -if (machine->no_cdrom) { default_cdrom =0 ; - } -if (machine->no_sdcard) { default_sdcard =0 ; + default_vga =0 ; }if (display_type ==DT_NOGRAPHIC ) {
Signature · 1 line
1.7.7.6
PATCH 12/12 cmdline: convert -no-shutdown and -no-reboot to QemuOpts
In reply to Paolo BonziniThey are also moved inside -machine.
--- qemu-config.c | 8 ++++++++ vl.c | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-)
qemu-config.c +8 -0
@@ -568,6 +568,14 @@ static QemuOptsList qemu_machine_opts = { .type = QEMU_OPT_BOOL, .help = "start machine immediately", }, { + .name = "no_reboot", + .type = QEMU_OPT_BOOL, + .help = "exit instead of rebooting", + }, { + .name = "no_shutdown", + .type = QEMU_OPT_BOOL, + .help = "stop before shutdown", + }, { .name = "bios", .type = QEMU_OPT_STRING, .help = "BIOS/firmware file",
vl.c +4 -2
@@ -2990,10 +2990,10 @@ int main(int argc, char **argv, char **envp) }break ;case QEMU_OPTION_no_reboot: - no_reboot =1 ; +qemu_opts_set (qemu_find_opts ("machine" ),0 ,"no_reboot" ,"on" );break ;case QEMU_OPTION_no_shutdown: - no_shutdown =1 ; +qemu_opts_set (qemu_find_opts ("machine" ),0 ,"no_shutdown" ,"on" );break ;case QEMU_OPTION_show_cursor: cursor_hide =0 ;
@@ -3309,6 +3309,8 @@ int main(int argc, char **argv, char **envp) kernel_filename = initrd_filename = kernel_cmdline =NULL ; ram_size =DEFAULT_RAM_SIZE *1024 *1024 ;if (machine_opts) { + no_reboot =qemu_opt_get_bool (machine_opts,"no_reboot" , false); + no_shutdown =qemu_opt_get_bool (machine_opts,"no_shutdown" , false); autostart =qemu_opt_get_bool (machine_opts,"autostart" , true); bios_name =qemu_opt_get (machine_opts,"bios" ); ram_size =qemu_opt_get_size (machine_opts,"ram_size" , ram_size);
Signature · 1 line
1.7.7.6
Re: [Qemu-devel] [PATCH 12/12] cmdline: convert -no-shutdown and -no-reboot to QemuOpts
Quoted 1 line · Paolo Bonzini
They are also moved inside -machine.
So why "no_reboot" and "no_shutdown" but "autostart" rather than "no_autostart"?
-- PMM
Re: [Qemu-devel] [PATCH 12/12] cmdline: convert -no-shutdown and -no-reboot to QemuOpts
Il 20/03/2012 10:04, Peter Maydell ha scritto:
Quoted 3 lines
Quoted 1 line
Quoted 1 line
They are also moved inside -machine.
So why "
no_reboot" and "no_shutdown" but "autostart" rather than "no_autostart"?
Because. :)
Seriously, perhaps we want two enum options on_reboot/on_shutdown with items reboot/stop/quit?
Paolo