qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: quintela@redhat.com, liang.z.li@intel.com, mjt@tls.msk.ru,
	qemu-devel@nongnu.org, amit.shah@redhat.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 2/3] Add migrate_incoming
Date: Thu, 26 Feb 2015 15:09:02 +0000	[thread overview]
Message-ID: <20150226150901.GG2371@work-vm> (raw)
In-Reply-To: <87r3tl9esl.fsf@blackfin.pond.sub.org>

* Markus Armbruster (armbru@redhat.com) wrote:
> I'd like Eric's opinion on on encoding configuration tuples as URIs
> rather than JSON in QMP.

I've just posted a series which should address all the issues in
here; but note that:

> > +void qmp_migrate_incoming(const char *uri, Error **errp)
> > +{
> > +    Error *local_err = NULL;
> > +
> > +    if (!deferred_incoming) {
> > +        error_setg(errp, "'-incoming defer' is required for migrate_incoming");
> > +        return;
> > +    }
> > +
> > +    qemu_start_incoming_migration(uri, &local_err);
> > +
> > +    if (local_err) {
> > +        error_propagate(errp, local_err);
> > +        return;
> > +    }
> > +
> > +    deferred_incoming = false;
> > +}
> > +
> 
> The error message refers to the command as "migrate_incoming", which is
> wrong for QMP.
> 
> Apart from that, the error message is fine when we fail because the user
> didn't specify -incoming defer.  It's unhelpful when we fail because
> migrate-incoming has already been run.
> 
> You could try something like
> 
>     void qmp_migrate_incoming(const char *uri, Error **errp)
>     {
>         Error *local_err = NULL;
> 
>         if (!deferred_incoming) {
>             error_setg(errp, "'-incoming defer' is required");
>             return;
>         }
>         if (!runstate_check(RUN_STATE_INMIGRATE)) {
>             error_setg(errp, "No migration incoming"
>             return;
>         }
> 
>         qemu_start_incoming_migration(uri, &local_err);
> 
>         if (local_err) {
>             error_propagate(errp, local_err);
>             return;
>         }
>     }
> 
> You're welcome to improve my rather laconic error messages.

doesn't work; because qemu_start_incoming_migration returns
immediately, and so:

migrate_incoming tcp::4444
migrate_incoming tcp::4444

fails trying to bind the port twice.  See the new patch series
for my way of fixing it.


Dave

> 
> >  void qmp_migrate(const char *uri, bool has_blk, bool blk,
> >                   bool has_inc, bool inc, bool has_detach, bool detach,
> >                   Error **errp)
> > diff --git a/qapi-schema.json b/qapi-schema.json
> > index e16f8eb..7a80081 100644
> > --- a/qapi-schema.json
> > +++ b/qapi-schema.json
> > @@ -1738,6 +1738,21 @@
> >  { 'command': 'migrate',
> >    'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool' } }
> >  
> > +##
> > +# @migrate-incoming
> > +#
> > +# Start an incoming migration, the qemu must have been started
> > +# with -incoming defer
> > +#
> > +# @uri: The Uniform Resource Identifier identifying the source or
> > +#       address to listen on
> > +#
> > +# Returns: nothing on success
> > +#
> > +# Since: 2.3
> > +##
> > +{ 'command': 'migrate-incoming', 'data': {'uri': 'str' } }
> > +
> >  # @xen-save-devices-state:
> >  #
> >  # Save the state of all devices to file. The RAM and the block devices
> 
> Eric, what's your take on this?
> 
> The general rule in QMP is "no ad hoc encoding of tuples in strings, use
> JSON objects instead".
> 
> > diff --git a/qmp-commands.hx b/qmp-commands.hx
> > index a85d847..60181c7 100644
> > --- a/qmp-commands.hx
> > +++ b/qmp-commands.hx
> > @@ -661,7 +661,36 @@ Example:
> >  <- { "return": {} }
> >  
> >  EQMP
> > -{
> > +
> > +    {
> > +        .name       = "migrate-incoming",
> > +        .args_type  = "uri:s",
> > +        .mhandler.cmd_new = qmp_marshal_input_migrate_incoming,
> > +    },
> > +
> > +SQMP
> > +migrate-incoming
> > +----------------
> > +
> > +Continue an incoming migration
> > +
> > +Arguments:
> > +
> > +- "uri": Source/listening URI (json-string)
> > +
> > +Example:
> > +
> > +-> { "execute": "migrate-incoming", "arguments": { "uri": "tcp::4446" } }
> > +<- { "return": {} }
> > +
> > +Notes:
> > +
> > +(1) QEMU must be started with -incoming defer to allow migrate-incoming to
> > +    be used
> > +(2) The uri format is the same as to -incoming
> > +
> > +EQMP
> > +    {
> >          .name       = "migrate-set-cache-size",
> >          .args_type  = "value:o",
> >          .mhandler.cmd_new = qmp_marshal_input_migrate_set_cache_size,
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  parent reply	other threads:[~2015-02-26 15:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-19 11:40 [Qemu-devel] [PATCH v3 0/3] -incoming defer Dr. David Alan Gilbert (git)
2015-02-19 11:40 ` [Qemu-devel] [PATCH v3 1/3] Add " Dr. David Alan Gilbert (git)
2015-02-20  7:56   ` Markus Armbruster
2015-02-20  9:09     ` Dr. David Alan Gilbert
2015-02-20  9:52       ` Markus Armbruster
2015-02-19 11:40 ` [Qemu-devel] [PATCH v3 2/3] Add migrate_incoming Dr. David Alan Gilbert (git)
2015-02-20  8:18   ` Markus Armbruster
2015-02-20  9:11     ` Dr. David Alan Gilbert
2015-02-20 13:05       ` Juan Quintela
2015-02-20 15:39     ` Eric Blake
2015-02-20 17:57       ` Markus Armbruster
2015-02-26 15:09     ` Dr. David Alan Gilbert [this message]
2015-02-19 11:40 ` [Qemu-devel] [PATCH v3 3/3] Document -incoming options Dr. David Alan Gilbert (git)
2015-02-20  9:15   ` Markus Armbruster
2015-02-26 20:34     ` Dr. David Alan Gilbert
2015-02-22  9:13 ` [Qemu-devel] [PATCH v3 0/3] -incoming defer Michael S. Tsirkin
2015-02-23 16:01   ` Dr. David Alan Gilbert
2015-02-23 10:38 ` Stefan Hajnoczi
2015-02-23 10:55   ` Dr. David Alan Gilbert
2015-02-24 11:01     ` Stefan Hajnoczi

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=20150226150901.GG2371@work-vm \
    --to=dgilbert@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=liang.z.li@intel.com \
    --cc=mjt@tls.msk.ru \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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).