qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: "Michal Privoznik" <mprivozn@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	qemu-devel@nongnu.org, "Max Reitz" <mreitz@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 1/2] vl: don't use RUN_STATE_PRECONFIG as initial state
Date: Tue, 5 Jun 2018 09:01:09 -0300	[thread overview]
Message-ID: <20180605120109.GD7451@localhost.localdomain> (raw)
In-Reply-To: <20180605103755.34840d5d@redhat.com>

On Tue, Jun 05, 2018 at 10:37:55AM +0200, Igor Mammedov wrote:
> On Mon, 4 Jun 2018 21:56:47 -0300
> Eduardo Habkost <ehabkost@redhat.com> 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).

Yeah, I'm not sure we want go towards encoding more knowledge in
the state machine, or keeping the system simple and encoding the
rules in more straightforward code+variables inside main().

> > 
> >     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
> > >   
> > 
> 

-- 
Eduardo

  reply	other threads:[~2018-06-05 12:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-04 12:03 [Qemu-devel] [PATCH v2 0/2] Avoid using RUN_STATE_PRECONFIG unless explicitly requested with --preconfig Daniel P. Berrangé
2018-06-04 12:03 ` [Qemu-devel] [PATCH v2 1/2] vl: don't use RUN_STATE_PRECONFIG as initial state Daniel P. Berrangé
2018-06-04 14:21   ` Michal Privoznik
2018-06-05  0:56     ` Eduardo Habkost
2018-06-05  8:37       ` Igor Mammedov
2018-06-05 12:01         ` Eduardo Habkost [this message]
2018-06-05 14:25           ` Igor Mammedov
2018-06-05 14:59             ` Eduardo Habkost
2018-06-05 11:59     ` Daniel P. Berrangé
2018-06-04 15:40   ` Igor Mammedov
2018-06-04 16:11     ` Daniel P. Berrangé
2018-06-04 17:37       ` Igor Mammedov
2018-06-05  0:35         ` Eduardo Habkost
2018-06-05  8:31           ` Igor Mammedov
2018-06-05 12:03   ` Daniel P. Berrangé
2018-06-04 12:03 ` [Qemu-devel] [PATCH v2 2/2] vl: fix use of --daemonize with --preconfig Daniel P. Berrangé
2018-06-04 14:21   ` Michal Privoznik
2018-06-04 15:01     ` Igor Mammedov
2018-06-04 15:15       ` Daniel P. Berrangé
2018-06-04 15:55         ` Igor Mammedov
2018-06-05  1:06       ` Eduardo Habkost
2018-06-05  7:10         ` Igor Mammedov
2018-06-04 21:53   ` Igor Mammedov
2018-06-05 12:00     ` Daniel P. Berrangé
2018-06-05 14:49       ` Igor Mammedov
2018-06-11  7:58 ` [Qemu-devel] [PATCH v2 0/2] Avoid using RUN_STATE_PRECONFIG unless explicitly requested " Michal Prívozník

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180605120109.GD7451@localhost.localdomain \
    --to=ehabkost@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mprivozn@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).