From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YR03z-0006p2-Gc for qemu-devel@nongnu.org; Thu, 26 Feb 2015 10:09:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YR03t-0005bl-Id for qemu-devel@nongnu.org; Thu, 26 Feb 2015 10:09:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34367) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YR03t-0005bd-Be for qemu-devel@nongnu.org; Thu, 26 Feb 2015 10:09:13 -0500 Date: Thu, 26 Feb 2015 15:09:02 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20150226150901.GG2371@work-vm> References: <1424346029-5410-1-git-send-email-dgilbert@redhat.com> <1424346029-5410-3-git-send-email-dgilbert@redhat.com> <87r3tl9esl.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r3tl9esl.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH v3 2/3] Add migrate_incoming List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: quintela@redhat.com, liang.z.li@intel.com, mjt@tls.msk.ru, qemu-devel@nongnu.org, amit.shah@redhat.com, pbonzini@redhat.com * 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