Message ID | 4E2D95A8.4060303@siemens.com |
---|---|
State | New |
Headers | show |
On Mon, Jul 25, 2011 at 06:11:20PM +0200, Jan Kiszka wrote: > I was incorrectly pointing the core, the problem is solvable at the > level where we parse -machine: > > -------8<-------- > > This allows to specify -machine options without setting an explicit > machine type. We will pick the default machine in this case. Requesting > the list of available machines is still possible via '-machine ?' e.g. > > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> > --- > vl.c | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/vl.c b/vl.c > index 8256504..5e53ddc 100644 > --- a/vl.c > +++ b/vl.c > @@ -2720,7 +2720,10 @@ int main(int argc, char **argv, char **envp) > fprintf(stderr, "parse error: %s\n", optarg); > exit(1); > } > - machine = machine_parse(qemu_opt_get(opts, "type")); > + optarg = qemu_opt_get(opts, "type"); > + if (optarg) { > + machine = machine_parse(optarg); > + } > break; > case QEMU_OPTION_usb: > usb_enabled = 1; > -- > 1.7.3.4 I have tested this patch, and it allows libguestfs to work without modifications. ie qemu -machine accel=[...] works as before. Rich.
On 25.07.2011, at 18:21, Richard W.M. Jones wrote: > On Mon, Jul 25, 2011 at 06:11:20PM +0200, Jan Kiszka wrote: >> I was incorrectly pointing the core, the problem is solvable at the >> level where we parse -machine: >> >> -------8<-------- >> >> This allows to specify -machine options without setting an explicit >> machine type. We will pick the default machine in this case. Requesting >> the list of available machines is still possible via '-machine ?' e.g. >> >> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> >> --- >> vl.c | 5 ++++- >> 1 files changed, 4 insertions(+), 1 deletions(-) >> >> diff --git a/vl.c b/vl.c >> index 8256504..5e53ddc 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -2720,7 +2720,10 @@ int main(int argc, char **argv, char **envp) >> fprintf(stderr, "parse error: %s\n", optarg); >> exit(1); >> } >> - machine = machine_parse(qemu_opt_get(opts, "type")); >> + optarg = qemu_opt_get(opts, "type"); >> + if (optarg) { >> + machine = machine_parse(optarg); >> + } >> break; >> case QEMU_OPTION_usb: >> usb_enabled = 1; >> -- >> 1.7.3.4 > > I have tested this patch, and it allows libguestfs to work without > modifications. ie qemu -machine accel=[...] works as before. Very nice! It's also a lot more intuitive this way. Alex
On 07/25/2011 11:11 AM, Jan Kiszka wrote: > On 2011-07-25 13:48, Jan Kiszka wrote: >> On 2011-07-25 13:39, Markus Armbruster wrote: >>> Jan Kiszka<jan.kiszka@siemens.com> writes: >>> >>>> On 2011-07-25 12:45, Richard W.M. Jones wrote: >>>>> On Mon, Jul 25, 2011 at 12:33:01PM +0200, Jan Kiszka wrote: >>>>>> On 2011-07-25 11:41, Richard W.M. Jones wrote: >>>>>>> On Sat, Jul 23, 2011 at 12:38:37PM +0200, Jan Kiszka wrote: >>>>>>>> From: Jan Kiszka<jan.kiszka@siemens.com> >>>>>>>> >>>>>>>> -machine somehow suggests that it selects the machine, but it doesn't. >>>>>>>> Fix that before this command is set in stone. >>>>>>>> >>>>>>>> Actually, -machine should supersede -M and allow to introduce arbitrary >>>>>>>> per-machine options to the command line. That will change the internal >>>>>>>> realization again, but we will be able to keep the user interface >>>>>>>> stable. >>>>>>> >>>>>>> This breaks libguestfs which was doing: >>>>>>> >>>>>>> qemu -machine accel=kvm:tcg ... >>>>>>> >>>>>>> We are not passing any -M option at all. We don't particularly care >>>>>>> about the machine type since we're not that performance sensitive and >>>>>>> we don't need to serialize the machine state. >>>>>>> >>>>>>> I have checked, and this works: >>>>>>> >>>>>>> qemu -machine pc,accel=kvm:tcg ... >>>>>>> >>>>>>> "pc" is the default, right? What about for other architectures? >>>>>> >>>>>> Yes, pc is the right default. Other arch have other defaults. >>>>> >>>>> So what you're saying is we have to parse qemu -machine \? output by >>>>> looking for the string '(default)'? eg: >>>>> >>>>> $ ./arm-softmmu/qemu-system-arm -machine \?|fgrep '(default)' >>>>> integratorcp ARM Integrator/CP (ARM926EJ-S) (default) >>>>> >>>>> $ ./i386-softmmu/qemu -machine \?|fgrep '(default)' >>>>> pc-0.14 Standard PC (default) >>>> >>>> I understand, this is clumsy. Will see if we can do better. >>> >>> Is there a technical reason why type isn't optional with -machine? >>> >>> [...] >> >> Maybe it's just the >> >> assert(!permit_abbrev || list->implied_opt_name); >> >> in qemu_opts_parse, but I haven't looked at all details (and all other >> users) yet. > > I was incorrectly pointing the core, the problem is solvable at the > level where we parse -machine: > > -------8<-------- > > This allows to specify -machine options without setting an explicit > machine type. We will pick the default machine in this case. Requesting > the list of available machines is still possible via '-machine ?' e.g. > > Signed-off-by: Jan Kiszka<jan.kiszka@siemens.com> Applied. Thanks. Regards, Anthony Liguori > --- > vl.c | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/vl.c b/vl.c > index 8256504..5e53ddc 100644 > --- a/vl.c > +++ b/vl.c > @@ -2720,7 +2720,10 @@ int main(int argc, char **argv, char **envp) > fprintf(stderr, "parse error: %s\n", optarg); > exit(1); > } > - machine = machine_parse(qemu_opt_get(opts, "type")); > + optarg = qemu_opt_get(opts, "type"); > + if (optarg) { > + machine = machine_parse(optarg); > + } > break; > case QEMU_OPTION_usb: > usb_enabled = 1;
diff --git a/vl.c b/vl.c index 8256504..5e53ddc 100644 --- a/vl.c +++ b/vl.c @@ -2720,7 +2720,10 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "parse error: %s\n", optarg); exit(1); } - machine = machine_parse(qemu_opt_get(opts, "type")); + optarg = qemu_opt_get(opts, "type"); + if (optarg) { + machine = machine_parse(optarg); + } break; case QEMU_OPTION_usb: usb_enabled = 1;