From patchwork Wed Feb 11 16:46:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 438899 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id EC3AF14029D for ; Thu, 12 Feb 2015 03:50:49 +1100 (AEDT) Received: from localhost ([::1]:45960 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLaUy-0003B0-8N for incoming@patchwork.ozlabs.org; Wed, 11 Feb 2015 11:50:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36092) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLaQz-00056L-Mr for qemu-devel@nongnu.org; Wed, 11 Feb 2015 11:46:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLaQt-00023A-6w for qemu-devel@nongnu.org; Wed, 11 Feb 2015 11:46:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLaQs-000230-W1 for qemu-devel@nongnu.org; Wed, 11 Feb 2015 11:46:35 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1BGkW29014904 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Feb 2015 11:46:33 -0500 Received: from dgilbert-t530.redhat.com (ovpn-116-115.ams2.redhat.com [10.36.116.115]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1BGkOQl013626; Wed, 11 Feb 2015 11:46:30 -0500 From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org Date: Wed, 11 Feb 2015 16:46:23 +0000 Message-Id: <1423673184-5903-3-git-send-email-dgilbert@redhat.com> In-Reply-To: <1423673184-5903-1-git-send-email-dgilbert@redhat.com> References: <1423673184-5903-1-git-send-email-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: quintela@redhat.com, liang.z.li@intel.com, mjt@tls.msk.ru, amit.shah@redhat.com, pbonzini@redhat.com Subject: [Qemu-devel] [PATCH v2 2/3] Add migrate_incoming X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Dr. David Alan Gilbert" Add migrate_incoming/migrate-incoming to start an incoming migration. Once a qemu has been started with -incoming pause the migration can be started by issuing: migrate_incoming uri Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Eric Blake Reviewed-by: Juan Quintela --- hmp-commands.hx | 16 ++++++++++++++++ hmp.c | 14 ++++++++++++++ hmp.h | 1 + migration/migration.c | 19 +++++++++++++++++++ qapi-schema.json | 15 +++++++++++++++ qmp-commands.hx | 31 ++++++++++++++++++++++++++++++- 6 files changed, 95 insertions(+), 1 deletion(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index e37bc8b..d889b73 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -922,6 +922,22 @@ Cancel the current VM migration. ETEXI { + .name = "migrate_incoming", + .args_type = "uri:s", + .params = "uri", + .help = "Unpause an incoming migration from an -incoming pause", + .mhandler.cmd = hmp_migrate_incoming, + }, + +STEXI +@item migrate_incoming @var{uri} +@findex migrate_incoming +Unpause an incoming migration using the @var{uri} (that has the same syntax +as the -incoming option). + +ETEXI + + { .name = "migrate_set_cache_size", .args_type = "value:o", .params = "value", diff --git a/hmp.c b/hmp.c index b47f331..f051896 100644 --- a/hmp.c +++ b/hmp.c @@ -1083,6 +1083,20 @@ void hmp_migrate_cancel(Monitor *mon, const QDict *qdict) qmp_migrate_cancel(NULL); } +void hmp_migrate_incoming(Monitor *mon, const QDict *qdict) +{ + Error *err = NULL; + const char *uri = qdict_get_str(qdict, "uri"); + + qmp_migrate_incoming(uri, &err); + + if (err) { + monitor_printf(mon, "%s\n", error_get_pretty(err)); + error_free(err); + return; + } +} + void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict) { double value = qdict_get_double(qdict, "value"); diff --git a/hmp.h b/hmp.h index 4bb5dca..95efe63 100644 --- a/hmp.h +++ b/hmp.h @@ -60,6 +60,7 @@ void hmp_snapshot_delete_blkdev_internal(Monitor *mon, const QDict *qdict); void hmp_drive_mirror(Monitor *mon, const QDict *qdict); void hmp_drive_backup(Monitor *mon, const QDict *qdict); void hmp_migrate_cancel(Monitor *mon, const QDict *qdict); +void hmp_migrate_incoming(Monitor *mon, const QDict *qdict); void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict); void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict); void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict); diff --git a/migration/migration.c b/migration/migration.c index 77263a5..c9f482d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -432,6 +432,25 @@ void migrate_del_blocker(Error *reason) migration_blockers = g_slist_remove(migration_blockers, reason); } +void qmp_migrate_incoming(const char *uri, Error **errp) +{ + Error *local_err = NULL; + + if (!paused_incoming) { + error_setg(errp, "-incoming pause is required for migrate_incoming"); + return; + } + + qemu_start_incoming_migration(uri, &local_err); + + if (local_err) { + error_propagate(errp, local_err); + return; + } + + paused_incoming = false; +} + 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..6093696 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 pause +# +# @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 diff --git a/qmp-commands.hx b/qmp-commands.hx index a85d847..79593fe 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 +---------------- + +Unpause 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 pause 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,