From patchwork Wed Apr 11 18:49:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Orit Wasserman X-Patchwork-Id: 151856 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 503CDB7061 for ; Thu, 12 Apr 2012 04:51:29 +1000 (EST) Received: from localhost ([::1]:59409 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SI2db-0000Pi-6W for incoming@patchwork.ozlabs.org; Wed, 11 Apr 2012 14:51:27 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SI2cK-0005u3-5R for qemu-devel@nongnu.org; Wed, 11 Apr 2012 14:50:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SI2cE-00056l-Pf for qemu-devel@nongnu.org; Wed, 11 Apr 2012 14:50:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25831) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SI2cE-000544-Gm for qemu-devel@nongnu.org; Wed, 11 Apr 2012 14:50:02 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3BInwoY018702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 11 Apr 2012 14:49:58 -0400 Received: from dhcp-1-120.tlv.redhat.com (reserved-201-244.tlv.redhat.com [10.35.201.244] (may be forged)) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q3BInUsL008086; Wed, 11 Apr 2012 14:49:54 -0400 From: Orit Wasserman To: qemu-devel@nongnu.org Date: Wed, 11 Apr 2012 21:49:10 +0300 Message-Id: <1334170153-9503-8-git-send-email-owasserm@redhat.com> In-Reply-To: <1334170153-9503-1-git-send-email-owasserm@redhat.com> References: <1334170153-9503-1-git-send-email-owasserm@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com, quintela@redhat.com, Petter Svard , stefanha@gmail.com, blauwirbel@gmail.com, Orit Wasserman , Benoit Hudzia , avi@redhat.com, Aidan Shribman Subject: [Qemu-devel] [PATCH v9 07/10] Add XBZRLE option to migrate command 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 Signed-off-by: Orit Wasserman Signed-off-by: Benoit Hudzia Signed-off-by: Petter Svard Signed-off-by: Aidan Shribman --- hmp-commands.hx | 20 ++++++++++++-------- hmp.c | 4 +++- migration.c | 9 +++++++++ qapi-schema.json | 2 +- qmp-commands.hx | 4 +++- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index a6f5a84..a73b538 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -798,23 +798,27 @@ ETEXI { .name = "migrate", - .args_type = "detach:-d,blk:-b,inc:-i,uri:s", - .params = "[-d] [-b] [-i] 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)", + .args_type = "detach:-d,blk:-b,inc:-i,xbzrle:-x,uri:s", + .params = "[-d] [-b] [-i] [-x] uri", + .help = "migrate to URI" + "\n\t -d to not wait for completion" + "\n\t -b for migration without shared storage with" + " full copy of disk" + "\n\t -i for migration without" + " shared storage with incremental copy of disk" + " (base image shared between source and destination)" + "\n\t -x to use XBZRLE page delta compression", .mhandler.cmd = hmp_migrate, }, STEXI -@item migrate [-d] [-b] [-i] @var{uri} +@item migrate [-d] [-b] [-i] [-x] @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) + -x to use XBZRLE page delta compression ETEXI { diff --git a/hmp.c b/hmp.c index f3e5163..891cac6 100644 --- a/hmp.c +++ b/hmp.c @@ -907,10 +907,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 xbzrle = qdict_get_try_bool(qdict, "xbzrle", 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, !!xbzrle, xbzrle, + &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 a524d5a..cea75aa 100644 --- a/migration.c +++ b/migration.c @@ -43,6 +43,11 @@ enum { #define MAX_THROTTLE (32 << 20) /* Migration speed throttling */ +/* Migration XBZRLE cache size */ +#define DEFAULT_MIGRATE_CACHE_SIZE (64 * 1024 * 1024) + +static int64_t migrate_cache_size = DEFAULT_MIGRATE_CACHE_SIZE; + static NotifierList migration_state_notifiers = NOTIFIER_LIST_INITIALIZER(migration_state_notifiers); @@ -389,6 +394,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, + bool has_xbzrle, bool xbzrle, Error **errp) { MigrationState *s = migrate_get_current(); @@ -399,6 +405,9 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, params.blk = blk; params.shared = inc; + params.use_xbzrle = xbzrle; + params.xbzrle_cache_size = migrate_cache_size; + if (s->state == MIG_STATE_ACTIVE) { error_set(errp, QERR_MIGRATION_ACTIVE); return; diff --git a/qapi-schema.json b/qapi-schema.json index ace55f3..200e4fc 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1683,7 +1683,7 @@ # Since: 0.14.0 ## { 'command': 'migrate', - 'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool' } } + 'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool', '*detach': 'bool', '*xbzrle': 'bool' } } # @xen-save-devices-state: # diff --git a/qmp-commands.hx b/qmp-commands.hx index c09ee85..f7a48de 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -469,7 +469,8 @@ EQMP { .name = "migrate", - .args_type = "detach:-d,blk:-b,inc:-i,uri:s", + .args_type = "detach:-d,blk:-b,inc:-i,xbzrle:-x,uri:s", + .params = "[-d] [-b] [-i] [-x] uri", .mhandler.cmd_new = qmp_marshal_input_migrate, }, @@ -484,6 +485,7 @@ Arguments: - "blk": block migration, full disk copy (json-bool, optional) - "inc": incremental disk copy (json-bool, optional) - "uri": Destination URI (json-string) +- "xbzrle": to use XBZRLE page delta compression Example: