From patchwork Thu Apr 5 10:47:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Orit Wasserman X-Patchwork-Id: 150937 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 78AC5B7038 for ; Thu, 5 Apr 2012 21:20:11 +1000 (EST) Received: from localhost ([::1]:51644 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFkjX-0000xD-VI for incoming@patchwork.ozlabs.org; Thu, 05 Apr 2012 07:20:07 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFkjD-0000Tk-IX for qemu-devel@nongnu.org; Thu, 05 Apr 2012 07:19:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SFkj0-0004Dl-Id for qemu-devel@nongnu.org; Thu, 05 Apr 2012 07:19:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFkj0-0004B3-Aa for qemu-devel@nongnu.org; Thu, 05 Apr 2012 07:19:34 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q35AoN1O028436 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 5 Apr 2012 06:50:23 -0400 Received: from dhcp-1-120.tlv.redhat.com (vpn-201-166.tlv.redhat.com [10.35.201.166]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q35AnC1i024561; Thu, 5 Apr 2012 06:50:19 -0400 From: Orit Wasserman To: qemu-devel@nongnu.org Date: Thu, 5 Apr 2012 13:47:56 +0300 Message-Id: <1333622879-12055-8-git-send-email-owasserm@redhat.com> In-Reply-To: <1333622879-12055-1-git-send-email-owasserm@redhat.com> References: <1333622879-12055-1-git-send-email-owasserm@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 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, stefanha@gmail.com, blauwirbel@gmail.com, Orit Wasserman , avi@redhat.com Subject: [Qemu-devel] [PATCH v8 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 --- 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 bd35a3e..88e345a 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -799,23 +799,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 9cf2d13..c2f8c31 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 4e2c3b3..66238de 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); @@ -388,6 +393,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(); @@ -398,6 +404,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 0d11d6e..8b1c78a 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 9447871..5d3714f 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -472,7 +472,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, }, @@ -487,6 +488,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: