From nobody Mon Feb 9 17:37:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493116372666319.3525449360527; Tue, 25 Apr 2017 03:32:52 -0700 (PDT) Received: from localhost ([::1]:48277 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2xm7-000246-5T for importer@patchew.org; Tue, 25 Apr 2017 06:32:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2xkG-0000ud-Dq for qemu-devel@nongnu.org; Tue, 25 Apr 2017 06:30:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2xkF-0004wY-AI for qemu-devel@nongnu.org; Tue, 25 Apr 2017 06:30:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37660) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2xkF-0004wL-1c for qemu-devel@nongnu.org; Tue, 25 Apr 2017 06:30:55 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 08C958047F for ; Tue, 25 Apr 2017 10:30:54 +0000 (UTC) Received: from secure.mitica (unknown [10.36.118.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 96D468078C; Tue, 25 Apr 2017 10:30:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 08C958047F Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 08C958047F From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 12:30:47 +0200 Message-Id: <20170425103049.4073-2-quintela@redhat.com> In-Reply-To: <20170425103049.4073-1-quintela@redhat.com> References: <20170425103049.4073-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 25 Apr 2017 10:30:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/3] migration: Create block capabilities for shared and enable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Those two capabilities were added through the command line. Notice that we just created them. This is just the boilerplate. Signed-off-by: Juan Quintela Reviewed-by: Eric Blake --- include/migration/migration.h | 3 +++ migration/migration.c | 36 ++++++++++++++++++++++++++++++++++++ qapi-schema.json | 7 ++++++- 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/include/migration/migration.h b/include/migration/migration.h index dfeca38..618ab0e 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -307,6 +307,9 @@ bool migrate_colo_enabled(void); =20 int64_t xbzrle_cache_resize(int64_t new_size); =20 +bool migrate_use_block_enabled(void); +bool migrate_use_block_shared(void); + bool migrate_use_compression(void); int migrate_compress_level(void); int migrate_compress_threads(void); diff --git a/migration/migration.c b/migration/migration.c index 5447cab..775b24c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1195,6 +1195,16 @@ bool migration_is_blocked(Error **errp) return false; } =20 +static void migrate_set_block_shared(MigrationState *s) +{ + s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK_SHARED] =3D true; +} + +static void migrate_set_block_enabled(MigrationState *s) +{ + s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK_ENABLED] =3D true; +} + void qmp_migrate(const char *uri, bool has_blk, bool blk, bool has_inc, bool inc, bool has_detach, bool detach, Error **errp) @@ -1224,6 +1234,14 @@ void qmp_migrate(const char *uri, bool has_blk, bool= blk, =20 s =3D migrate_init(¶ms); =20 + if (has_blk && blk) { + migrate_set_block_enabled(s); + } + + if (has_inc && inc) { + migrate_set_block_shared(s); + } + if (strstart(uri, "tcp:", &p)) { tcp_start_outgoing_migration(s, p, &local_err); #ifdef CONFIG_RDMA @@ -1419,6 +1437,24 @@ int64_t migrate_xbzrle_cache_size(void) return s->xbzrle_cache_size; } =20 +bool migrate_use_block_enabled(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK_ENABLED]; +} + +bool migrate_use_block_shared(void) +{ + MigrationState *s; + + s =3D migrate_get_current(); + + return s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK_SHARED]; +} + /* migration thread support */ /* * Something bad happened to the RP stream, mark an error diff --git a/qapi-schema.json b/qapi-schema.json index 01b087f..e963bb3 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -894,11 +894,16 @@ # @release-ram: if enabled, qemu will free the migrated ram pages on the s= ource # during postcopy-ram migration. (since 2.9) # +# @block-enabled: enable block migration (Since 2.10) +# +# @block-shared: enable block shared migration (Since 2.10) +# # Since: 1.2 ## { 'enum': 'MigrationCapability', 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', - 'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram'] } + 'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram', + 'block-enabled', 'block-shared' ] } =20 ## # @MigrationCapabilityStatus: --=20 2.9.3