From patchwork Tue Oct 30 08:33:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 1668911 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B614D3FDDA for ; Tue, 30 Oct 2012 08:36:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756548Ab2J3Ie2 (ORCPT ); Tue, 30 Oct 2012 04:34:28 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:41322 "EHLO mail.valinux.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756287Ab2J3IdW (ORCPT ); Tue, 30 Oct 2012 04:33:22 -0400 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id E3B02181CA; Tue, 30 Oct 2012 17:33:13 +0900 (JST) Received: (nullmailer pid 29469 invoked by uid 1000); Tue, 30 Oct 2012 08:33:13 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org, kvm@vger.kernel.org Cc: quintela@redhat.com, pbonzini@redhat.com, owasserm@redhat.com, avi@redhat.com, dlaor@redhat.com, mdroth@linux.vnet.ibm.com, t.hirofuchi@aist.go.jp, satoshi.itoh@aist.go.jp, stefanha@gmail.com, yoshikawa.takuya@oss.ntt.co.jp, benoit.hudzia@gmail.com, aarcange@redhat.com, chegu_vinod@hp.com, aliguori@us.ibm.com Subject: [PATCH v3 24/35] postcopy outgoing: add -p option to migrate command Date: Tue, 30 Oct 2012 17:33:00 +0900 Message-Id: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Added -p option to migrate command for postcopy mode and introduce postcopy parameter for migration to indicate that postcopy mode is enabled. Signed-off-by: Isaku Yamahata --- Chnages v1 -> v2: - catch up for qapi change --- hmp-commands.hx | 10 ++++++---- hmp.c | 4 +++- migration.c | 3 ++- migration.h | 1 + qapi-schema.json | 3 ++- qmp-commands.hx | 3 ++- savevm.c | 3 ++- 7 files changed, 18 insertions(+), 9 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index e0b537d..f2f1264 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -826,23 +826,25 @@ ETEXI { .name = "migrate", - .args_type = "detach:-d,blk:-b,inc:-i,uri:s", - .params = "[-d] [-b] [-i] uri", + .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,uri:s", + .params = "[-d] [-b] [-i] [-p] uri", .help = "migrate to URI (using -d to not wait for completion)" "\n\t\t\t -b for migration without shared storage with" " full copy of disk\n\t\t\t -i for migration without " "shared storage with incremental copy of disk " - "(base image shared between src and destination)", + "(base image shared between src and destination)" + "\n\t\t\t-p for migration with postcopy mode enabled", .mhandler.cmd = hmp_migrate, }, STEXI -@item migrate [-d] [-b] [-i] @var{uri} +@item migrate [-d] [-b] [-i] [-p] @var{uri} @findex migrate Migrate to @var{uri} (using -d to not wait for completion). -b for migration with full copy of disk -i for migration with incremental copy of disk (base image is shared) + -p for migration with postcopy mode enabled ETEXI { diff --git a/hmp.c b/hmp.c index 2b97982..2ea3bc4 100644 --- a/hmp.c +++ b/hmp.c @@ -1035,10 +1035,12 @@ void hmp_migrate(Monitor *mon, const QDict *qdict) int detach = qdict_get_try_bool(qdict, "detach", 0); int blk = qdict_get_try_bool(qdict, "blk", 0); int inc = qdict_get_try_bool(qdict, "inc", 0); + int postcopy = qdict_get_try_bool(qdict, "postcopy", 0); const char *uri = qdict_get_str(qdict, "uri"); Error *err = NULL; - qmp_migrate(uri, !!blk, blk, !!inc, inc, false, false, &err); + qmp_migrate(uri, !!blk, blk, !!inc, inc, false, false, + !!postcopy, postcopy, &err); if (err) { monitor_printf(mon, "migrate: %s\n", error_get_pretty(err)); error_free(err); diff --git a/migration.c b/migration.c index 00b0bc2..8bb6073 100644 --- a/migration.c +++ b/migration.c @@ -480,7 +480,7 @@ void migrate_del_blocker(Error *reason) void qmp_migrate(const char *uri, bool has_blk, bool blk, bool has_inc, bool inc, bool has_detach, bool detach, - Error **errp) + bool has_postcopy, bool postcopy, Error **errp) { MigrationState *s = migrate_get_current(); MigrationParams params; @@ -489,6 +489,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, params.blk = blk; params.shared = inc; + params.postcopy = postcopy; if (s->state == MIG_STATE_ACTIVE) { error_set(errp, QERR_MIGRATION_ACTIVE); diff --git a/migration.h b/migration.h index 0766691..b21df18 100644 --- a/migration.h +++ b/migration.h @@ -24,6 +24,7 @@ struct MigrationParams { bool blk; bool shared; + bool postcopy; }; typedef struct MigrationState MigrationState; diff --git a/qapi-schema.json b/qapi-schema.json index c615ee2..c969e5a 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -2094,7 +2094,8 @@ # Since: 0.14.0 ## { 'command': 'migrate', - 'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool' } } + 'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool' , + '*postcopy': 'bool'} } # @xen-save-devices-state: # diff --git a/qmp-commands.hx b/qmp-commands.hx index 5ba8c48..ece7a7e 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -518,7 +518,7 @@ EQMP { .name = "migrate", - .args_type = "detach:-d,blk:-b,inc:-i,uri:s", + .args_type = "detach:-d,blk:-b,inc:-i,postcopy:-p,uri:s", .mhandler.cmd_new = qmp_marshal_input_migrate, }, @@ -532,6 +532,7 @@ Arguments: - "blk": block migration, full disk copy (json-bool, optional) - "inc": incremental disk copy (json-bool, optional) +- "postcopy": postcopy migration (json-bool, optional) - "uri": Destination URI (json-string) Example: diff --git a/savevm.c b/savevm.c index d1488d2..04b03cf 100644 --- a/savevm.c +++ b/savevm.c @@ -1806,7 +1806,8 @@ static int qemu_savevm_state(QEMUFile *f) int ret; MigrationParams params = { .blk = 0, - .shared = 0 + .shared = 0, + .postcopy = 0, }; if (qemu_savevm_state_blocked(NULL)) {