[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 1/2] vl: don't use RUN_STATE_PRECONFIG as ini
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [PATCH v2 1/2] vl: don't use RUN_STATE_PRECONFIG as initial state |
Date: |
Tue, 5 Jun 2018 10:37:55 +0200 |
On Mon, 4 Jun 2018 21:56:47 -0300
Eduardo Habkost <address@hidden> wrote:
> On Mon, Jun 04, 2018 at 04:21:47PM +0200, Michal Privoznik wrote:
> [...]
> > > @@ -3572,7 +3570,12 @@ int main(int argc, char **argv, char **envp)
> > > }
> > > break;
> > > case QEMU_OPTION_preconfig:
> > > - preconfig_exit_requested = false;
> > > + if (!runstate_check(RUN_STATE_NONE)) {
> > > + error_report("'--preconfig' and '--incoming' options
> > > are "
> > > + "mutually exclusive");
> > > + exit(EXIT_FAILURE);
> > > + }
> > > + runstate_set(RUN_STATE_PRECONFIG);
> >
> > Specifying --preconfig twice on the command line now fails with a very
> > cryptic message (there's no --incoming).
> >
> > > break;
> > > case QEMU_OPTION_enable_kvm:
> > > olist = qemu_find_opts("machine");
> > > @@ -3768,9 +3771,12 @@ int main(int argc, char **argv, char **envp)
> > > }
> > > break;
> > > case QEMU_OPTION_incoming:
> > > - if (!incoming) {
> > > - runstate_set(RUN_STATE_INMIGRATE);
> > > + if (!runstate_check(RUN_STATE_NONE)) {
> > > + error_report("'--preconfig' and '--incoming' options
> > > are "
> > > + "mutually exclusive");
> > > + exit(EXIT_FAILURE);
> > > }
> > > + runstate_set(RUN_STATE_INMIGRATE);
> >
> > Same here. Specifying --incoming twice fails with cryptic message. But
> > one can argue that specifying --incoming twice is wrong anyway.
> >
>
> Initially I was going to suggest simply not changing runstate
> during option parsing to avoid this kind of problem, but maybe
> this would be a nice way to implement the command-line parsing
> rules:
Is there a big reason to try making early incoming transition hack nicer?
I'd rather leave it as it is for now and fix it properly later
(i.e. postponing the transition after machine_done point, which is on my
todo list).
>
> case QEMU_OPTION_preconfig:
> /*
> * A INCOMING -> PRECONFIG transition would call:
> * error_setg("--preconfig and --incoming options are mutually
> exclusive");
> */
> try_runstate_set(RUN_STATE_PRECONFIG, &error_fatal);
> break;
> case QEMU_OPTION_incoming:
> /*
> * A PRECONFIG -> INCOMING transition would also call:
> * error_setg("--preconfig and --incoming options are mutually
> exclusive");
> *
> * Maybe a INCOMING -> INCOMING transition could
> * result in:
> * error_setg("--incoming can't be specified twice");
> */
> try_runstate_set(RUN_STATE_INMIGRATE, &error_fatal);
> break;
>
>
> > > incoming = optarg;
> > > break;
> > > case QEMU_OPTION_only_migratable:
> >
> > Michal
> >
>
Re: [Qemu-devel] [PATCH v2 1/2] vl: don't use RUN_STATE_PRECONFIG as initial state, Igor Mammedov, 2018/06/04
Re: [Qemu-devel] [PATCH v2 1/2] vl: don't use RUN_STATE_PRECONFIG as initial state, Daniel P . Berrangé, 2018/06/05