From nobody Mon Apr 29 14:46:11 2024 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.zohomail.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 1500280077868529.0868984269496; Mon, 17 Jul 2017 01:27:57 -0700 (PDT) Received: from localhost ([::1]:48735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1Nj-0007LD-WF for importer@patchew.org; Mon, 17 Jul 2017 04:27:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1MF-0006Mq-Ns for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:26:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX1ME-0001lj-P8 for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:26:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37208) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX1ME-0001lc-G6 for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:26:22 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 833DA4E4D4 for ; Mon, 17 Jul 2017 08:26:21 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24C2B173C3; Mon, 17 Jul 2017 08:26:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 833DA4E4D4 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 833DA4E4D4 From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 16:26:01 +0800 Message-Id: <1500279971-13875-2-git-send-email-peterx@redhat.com> In-Reply-To: <1500279971-13875-1-git-send-email-peterx@redhat.com> References: <1500279971-13875-1-git-send-email-peterx@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 17 Jul 2017 08:26:21 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 01/11] qdev: provide DEFINE_PROP_INT64() 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: Laurent Vivier , Eduardo Habkost , Juan Quintela , "Dr . David Alan Gilbert" , Peter Xu , Markus Armbruster , Marcel Apfelbaum , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We have merely all the stuff, but this one is missing. Add it in. Am going to use this new helper for MigrationParameters fields, since most of them are int64_t. CC: Markus Armbruster CC: Eduardo Habkost CC: Marc-Andr=C3=A9 Lureau CC: Peter Xu CC: Juan Quintela CC: Marcel Apfelbaum Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Peter Xu Acked-by: Eduardo Habkost Reviewed-by: Juan Quintela Reviewed-by: Marcel Apfelbaum --- hw/core/qdev-properties.c | 32 ++++++++++++++++++++++++++++++++ include/hw/qdev-properties.h | 3 +++ 2 files changed, 35 insertions(+) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index dcecdf0..c1d4e54 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -404,6 +404,31 @@ static void set_uint64(Object *obj, Visitor *v, const = char *name, visit_type_uint64(v, name, ptr, errp); } =20 +static void get_int64(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + DeviceState *dev =3D DEVICE(obj); + Property *prop =3D opaque; + int64_t *ptr =3D qdev_get_prop_ptr(dev, prop); + + visit_type_int64(v, name, ptr, errp); +} + +static void set_int64(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + DeviceState *dev =3D DEVICE(obj); + Property *prop =3D opaque; + int64_t *ptr =3D qdev_get_prop_ptr(dev, prop); + + if (dev->realized) { + qdev_prop_set_after_realize(dev, name, errp); + return; + } + + visit_type_int64(v, name, ptr, errp); +} + const PropertyInfo qdev_prop_uint64 =3D { .name =3D "uint64", .get =3D get_uint64, @@ -411,6 +436,13 @@ const PropertyInfo qdev_prop_uint64 =3D { .set_default_value =3D set_default_value_uint, }; =20 +const PropertyInfo qdev_prop_int64 =3D { + .name =3D "int64", + .get =3D get_int64, + .set =3D set_int64, + .set_default_value =3D set_default_value_int, +}; + /* --- string --- */ =20 static void release_string(Object *obj, const char *name, void *opaque) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index f6692d5..30af33b 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -13,6 +13,7 @@ extern const PropertyInfo qdev_prop_uint16; extern const PropertyInfo qdev_prop_uint32; extern const PropertyInfo qdev_prop_int32; extern const PropertyInfo qdev_prop_uint64; +extern const PropertyInfo qdev_prop_int64; extern const PropertyInfo qdev_prop_size; extern const PropertyInfo qdev_prop_string; extern const PropertyInfo qdev_prop_chr; @@ -136,6 +137,8 @@ extern const PropertyInfo qdev_prop_link; DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int32, int32_t) #define DEFINE_PROP_UINT64(_n, _s, _f, _d) \ DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint64, uint64_t) +#define DEFINE_PROP_INT64(_n, _s, _f, _d) \ + DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int64, int64_t) #define DEFINE_PROP_SIZE(_n, _s, _f, _d) \ DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size, uint64_t) #define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \ --=20 2.7.4 From nobody Mon Apr 29 14:46:11 2024 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.zohomail.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 1500280089512401.72599547148593; Mon, 17 Jul 2017 01:28:09 -0700 (PDT) Received: from localhost ([::1]:48736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1Nw-0007WI-2U for importer@patchew.org; Mon, 17 Jul 2017 04:28:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1MM-0006QZ-Kq for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:26:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX1MH-0001mC-OP for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:26:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37248) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX1MH-0001m4-F6 for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:26:25 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1CB0E4E4D6 for ; Mon, 17 Jul 2017 08:26:24 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9C637D693; Mon, 17 Jul 2017 08:26:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1CB0E4E4D6 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1CB0E4E4D6 From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 16:26:02 +0800 Message-Id: <1500279971-13875-3-git-send-email-peterx@redhat.com> In-Reply-To: <1500279971-13875-1-git-send-email-peterx@redhat.com> References: <1500279971-13875-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 17 Jul 2017 08:26:24 +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 v2 02/11] migration: export parameters to props 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: Laurent Vivier , Eduardo Habkost , Juan Quintela , "Dr . David Alan Gilbert" , Peter Xu , Markus Armbruster 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" Export migration parameters to qdev properties. Then we can use, for example: -global migration.x-cpu-throttle-initial=3Dxxx To specify migration parameters during init. Prefix "x-" is appended for each parameter exported to show that this is not a stable interface, and only for debugging/testing purpose. Signed-off-by: Peter Xu Reviewed-by: Juan Quintela --- migration/migration.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index a0db40d..ad2505c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2009,6 +2009,31 @@ static Property migration_properties[] =3D { send_configuration, true), DEFINE_PROP_BOOL("send-section-footer", MigrationState, send_section_footer, true), + + /* Migration parameters */ + DEFINE_PROP_INT64("x-compress-level", MigrationState, + parameters.compress_level, + DEFAULT_MIGRATE_COMPRESS_LEVEL), + DEFINE_PROP_INT64("x-compress-threads", MigrationState, + parameters.compress_threads, + DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT), + DEFINE_PROP_INT64("x-decompress-threads", MigrationState, + parameters.decompress_threads, + DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT), + DEFINE_PROP_INT64("x-cpu-throttle-initial", MigrationState, + parameters.cpu_throttle_initial, + DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL), + DEFINE_PROP_INT64("x-cpu-throttle-increment", MigrationState, + parameters.cpu_throttle_increment, + DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT), + DEFINE_PROP_INT64("x-max-bandwidth", MigrationState, + parameters.max_bandwidth, MAX_THROTTLE), + DEFINE_PROP_INT64("x-downtime-limit", MigrationState, + parameters.downtime_limit, + DEFAULT_MIGRATE_SET_DOWNTIME), + DEFINE_PROP_INT64("x-checkpoint-delay", MigrationState, + parameters.x_checkpoint_delay, + DEFAULT_MIGRATE_X_CHECKPOINT_DELAY), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -2027,16 +2052,6 @@ static void migration_instance_init(Object *obj) ms->state =3D MIGRATION_STATUS_NONE; ms->xbzrle_cache_size =3D DEFAULT_MIGRATE_CACHE_SIZE; ms->mbps =3D -1; - ms->parameters =3D (MigrationParameters) { - .compress_level =3D DEFAULT_MIGRATE_COMPRESS_LEVEL, - .compress_threads =3D DEFAULT_MIGRATE_COMPRESS_THREAD_COUNT, - .decompress_threads =3D DEFAULT_MIGRATE_DECOMPRESS_THREAD_COUNT, - .cpu_throttle_initial =3D DEFAULT_MIGRATE_CPU_THROTTLE_INITIAL, - .cpu_throttle_increment =3D DEFAULT_MIGRATE_CPU_THROTTLE_INCREMENT, - .max_bandwidth =3D MAX_THROTTLE, - .downtime_limit =3D DEFAULT_MIGRATE_SET_DOWNTIME, - .x_checkpoint_delay =3D DEFAULT_MIGRATE_X_CHECKPOINT_DELAY, - }; ms->parameters.tls_creds =3D g_strdup(""); ms->parameters.tls_hostname =3D g_strdup(""); } --=20 2.7.4 From nobody Mon Apr 29 14:46:11 2024 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.zohomail.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 15002802193031.090914882375273; Mon, 17 Jul 2017 01:30:19 -0700 (PDT) Received: from localhost ([::1]:48745 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1Q1-0001Ge-KV for importer@patchew.org; Mon, 17 Jul 2017 04:30:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1MM-0006Qc-ML for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:26:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX1MK-0001nh-Ep for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:26:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48404) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX1MK-0001nZ-8Z for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:26:28 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4142D85363 for ; Mon, 17 Jul 2017 08:26:27 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8616177EAD; Mon, 17 Jul 2017 08:26:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4142D85363 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4142D85363 From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 16:26:03 +0800 Message-Id: <1500279971-13875-4-git-send-email-peterx@redhat.com> In-Reply-To: <1500279971-13875-1-git-send-email-peterx@redhat.com> References: <1500279971-13875-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 17 Jul 2017 08:26:27 +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 v2 03/11] migration: export capabilities to props 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: Laurent Vivier , Eduardo Habkost , Juan Quintela , "Dr . David Alan Gilbert" , Peter Xu , Markus Armbruster 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" Do the same thing to migration capabilities, just like what we did in previous patch for migration parameters. Signed-off-by: Peter Xu Reviewed-by: Eduardo Habkost Reviewed-by: Juan Quintela --- migration/migration.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index ad2505c..3208162 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2001,6 +2001,9 @@ void migration_global_dump(Monitor *mon) ms->send_configuration, ms->send_section_footer); } =20 +#define DEFINE_PROP_MIG_CAP(name, x) \ + DEFINE_PROP_BOOL(name, MigrationState, enabled_capabilities[x], false) + static Property migration_properties[] =3D { DEFINE_PROP_BOOL("store-global-state", MigrationState, store_global_state, true), @@ -2034,6 +2037,20 @@ static Property migration_properties[] =3D { DEFINE_PROP_INT64("x-checkpoint-delay", MigrationState, parameters.x_checkpoint_delay, DEFAULT_MIGRATE_X_CHECKPOINT_DELAY), + + /* Migration capabilities */ + DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), + DEFINE_PROP_MIG_CAP("x-rdma-pin-all", MIGRATION_CAPABILITY_RDMA_PIN_AL= L), + DEFINE_PROP_MIG_CAP("x-auto-converge", MIGRATION_CAPABILITY_AUTO_CONVE= RGE), + DEFINE_PROP_MIG_CAP("x-zero-blocks", MIGRATION_CAPABILITY_ZERO_BLOCKS), + DEFINE_PROP_MIG_CAP("x-compress", MIGRATION_CAPABILITY_COMPRESS), + DEFINE_PROP_MIG_CAP("x-events", MIGRATION_CAPABILITY_EVENTS), + DEFINE_PROP_MIG_CAP("x-postcopy-ram", MIGRATION_CAPABILITY_POSTCOPY_RA= M), + DEFINE_PROP_MIG_CAP("x-colo", MIGRATION_CAPABILITY_X_COLO), + DEFINE_PROP_MIG_CAP("x-release-ram", MIGRATION_CAPABILITY_RELEASE_RAM), + DEFINE_PROP_MIG_CAP("x-block", MIGRATION_CAPABILITY_BLOCK), + DEFINE_PROP_MIG_CAP("x-return-path", MIGRATION_CAPABILITY_RETURN_PATH), + DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.7.4 From nobody Mon Apr 29 14:46:11 2024 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.zohomail.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 1500280112430549.5712926792609; Mon, 17 Jul 2017 01:28:32 -0700 (PDT) Received: from localhost ([::1]:48737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1OJ-0007qt-74 for importer@patchew.org; Mon, 17 Jul 2017 04:28:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1Me-0006g2-FG for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:26:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX1MZ-0001vT-JG for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:26:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57362) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX1MZ-0001ut-DF for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:26:43 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 684817CB86; Mon, 17 Jul 2017 08:26:42 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id A65267801A; Mon, 17 Jul 2017 08:26:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 684817CB86 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 684817CB86 From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 16:26:04 +0800 Message-Id: <1500279971-13875-5-git-send-email-peterx@redhat.com> In-Reply-To: <1500279971-13875-1-git-send-email-peterx@redhat.com> References: <1500279971-13875-1-git-send-email-peterx@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 17 Jul 2017 08:26:42 +0000 (UTC) Content-Transfer-Encoding: quoted-printable 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 v2 04/11] qom: call parent first on post_init() 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: Laurent Vivier , Eduardo Habkost , Juan Quintela , "Dr . David Alan Gilbert" , Peter Xu , Markus Armbruster , =?UTF-8?q?Andreas=20F=C3=A4rber?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It makes more sense to call the post_init() hook of the parent first then the child, just like what we do in the rest of the hooks. CC: Andreas F=C3=A4rber CC: Markus Armbruster CC: Eduardo Habkost Signed-off-by: Peter Xu --- qom/object.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qom/object.c b/qom/object.c index dfdbd50..e2c9c4a 100644 --- a/qom/object.c +++ b/qom/object.c @@ -347,13 +347,13 @@ static void object_init_with_type(Object *obj, TypeIm= pl *ti) =20 static void object_post_init_with_type(Object *obj, TypeImpl *ti) { - if (ti->instance_post_init) { - ti->instance_post_init(obj); - } - if (type_has_parent(ti)) { object_post_init_with_type(obj, type_get_parent(ti)); } + + if (ti->instance_post_init) { + ti->instance_post_init(obj); + } } =20 static void object_initialize_with_type(void *data, size_t size, TypeImpl = *type) --=20 2.7.4 From nobody Mon Apr 29 14:46:11 2024 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.zohomail.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 1500280237730875.3997650111844; Mon, 17 Jul 2017 01:30:37 -0700 (PDT) Received: from localhost ([::1]:48751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1QI-0001bI-Ll for importer@patchew.org; Mon, 17 Jul 2017 04:30:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60560) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1Mt-0006tN-Lh for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX1Mo-00023L-FS for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49150) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX1Mo-00022w-64 for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:26:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 087CF81241 for ; Mon, 17 Jul 2017 08:26:57 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4A237801A; Mon, 17 Jul 2017 08:26:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 087CF81241 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 087CF81241 From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 16:26:05 +0800 Message-Id: <1500279971-13875-6-git-send-email-peterx@redhat.com> In-Reply-To: <1500279971-13875-1-git-send-email-peterx@redhat.com> References: <1500279971-13875-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 17 Jul 2017 08:26:57 +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 v2 05/11] migration: introduce migrate_params_check() 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: Laurent Vivier , Eduardo Habkost , Juan Quintela , "Dr . David Alan Gilbert" , Peter Xu , Markus Armbruster 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" Helper to check the parameters. Abstracted from qmp_migrate_set_parameters(). Signed-off-by: Peter Xu Reviewed-by: Juan Quintela --- migration/migration.c | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 3208162..2821f8a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -643,64 +643,86 @@ void qmp_migrate_set_capabilities(MigrationCapability= StatusList *params, } } =20 -void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) +/* + * Check whether the parameters are valid. Error will be put into errp + * (if provided). Return true if valid, otherwise false. + */ +static bool migrate_params_check(MigrationParameters *params, Error **errp) { - MigrationState *s =3D migrate_get_current(); - if (params->has_compress_level && (params->compress_level < 0 || params->compress_level > 9)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level", "is invalid, it should be in the range of 0 to 9"); - return; + return false; } + if (params->has_compress_threads && (params->compress_threads < 1 || params->compress_threads > 255)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_threads", "is invalid, it should be in the range of 1 to 255"); - return; + return false; } + if (params->has_decompress_threads && (params->decompress_threads < 1 || params->decompress_threads > 25= 5)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "decompress_threads", "is invalid, it should be in the range of 1 to 255"); - return; + return false; } + if (params->has_cpu_throttle_initial && (params->cpu_throttle_initial < 1 || params->cpu_throttle_initial > 99)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_initial", "an integer in the range of 1 to 99"); - return; + return false; } + if (params->has_cpu_throttle_increment && (params->cpu_throttle_increment < 1 || params->cpu_throttle_increment > 99)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_increment", "an integer in the range of 1 to 99"); - return; + return false; } + if (params->has_max_bandwidth && (params->max_bandwidth < 0 || params->max_bandwidth > SIZE_MAX)) { error_setg(errp, "Parameter 'max_bandwidth' expects an integer in = the" " range of 0 to %zu bytes/second", SIZE_MAX); - return; + return false; } + if (params->has_downtime_limit && (params->downtime_limit < 0 || params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { error_setg(errp, "Parameter 'downtime_limit' expects an integer in= " "the range of 0 to %d milliseconds", MAX_MIGRATE_DOWNTIME); - return; + return false; } + if (params->has_x_checkpoint_delay && (params->x_checkpoint_delay < 0)= ) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "x_checkpoint_delay", "is invalid, it should be positive"); + return false; + } + + return true; +} + +void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) +{ + MigrationState *s =3D migrate_get_current(); + + if (!migrate_params_check(params, errp)) { + /* Invalid parameter */ + return; } =20 if (params->has_compress_level) { --=20 2.7.4 From nobody Mon Apr 29 14:46:11 2024 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.zohomail.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 1500280260360549.6093830001133; Mon, 17 Jul 2017 01:31:00 -0700 (PDT) Received: from localhost ([::1]:48752 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1Qf-0001vi-De for importer@patchew.org; Mon, 17 Jul 2017 04:30:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1Mv-0006uw-8F for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX1Mu-00026D-G0 for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45708) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX1Mu-00025F-7r for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:04 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 173E97CE10 for ; Mon, 17 Jul 2017 08:27:03 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6153277EAD; Mon, 17 Jul 2017 08:26:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 173E97CE10 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=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 173E97CE10 From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 16:26:06 +0800 Message-Id: <1500279971-13875-7-git-send-email-peterx@redhat.com> In-Reply-To: <1500279971-13875-1-git-send-email-peterx@redhat.com> References: <1500279971-13875-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 17 Jul 2017 08:27:03 +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 v2 06/11] migration: provide migrate_params_apply() 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: Laurent Vivier , Eduardo Habkost , Juan Quintela , "Dr . David Alan Gilbert" , Peter Xu , Markus Armbruster 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" Abstracted from qmp_migrate_set_parameters(). Signed-off-by: Peter Xu Reviewed-by: Juan Quintela --- migration/migration.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 2821f8a..8c65054 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -716,38 +716,40 @@ static bool migrate_params_check(MigrationParameters = *params, Error **errp) return true; } =20 -void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) +static void migrate_params_apply(MigrationParameters *params) { MigrationState *s =3D migrate_get_current(); =20 - if (!migrate_params_check(params, errp)) { - /* Invalid parameter */ - return; - } - if (params->has_compress_level) { s->parameters.compress_level =3D params->compress_level; } + if (params->has_compress_threads) { s->parameters.compress_threads =3D params->compress_threads; } + if (params->has_decompress_threads) { s->parameters.decompress_threads =3D params->decompress_threads; } + if (params->has_cpu_throttle_initial) { s->parameters.cpu_throttle_initial =3D params->cpu_throttle_initia= l; } + if (params->has_cpu_throttle_increment) { s->parameters.cpu_throttle_increment =3D params->cpu_throttle_incr= ement; } + if (params->has_tls_creds) { g_free(s->parameters.tls_creds); s->parameters.tls_creds =3D g_strdup(params->tls_creds); } + if (params->has_tls_hostname) { g_free(s->parameters.tls_hostname); s->parameters.tls_hostname =3D g_strdup(params->tls_hostname); } + if (params->has_max_bandwidth) { s->parameters.max_bandwidth =3D params->max_bandwidth; if (s->to_dst_file) { @@ -755,6 +757,7 @@ void qmp_migrate_set_parameters(MigrationParameters *pa= rams, Error **errp) s->parameters.max_bandwidth / XFER_LIMIT_R= ATIO); } } + if (params->has_downtime_limit) { s->parameters.downtime_limit =3D params->downtime_limit; } @@ -765,11 +768,22 @@ void qmp_migrate_set_parameters(MigrationParameters *= params, Error **errp) colo_checkpoint_notify(s); } } + if (params->has_block_incremental) { s->parameters.block_incremental =3D params->block_incremental; } } =20 +void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) +{ + if (!migrate_params_check(params, errp)) { + /* Invalid parameter */ + return; + } + + migrate_params_apply(params); +} + =20 void qmp_migrate_start_postcopy(Error **errp) { --=20 2.7.4 From nobody Mon Apr 29 14:46:11 2024 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.zohomail.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 1500280423212627.0489714547514; Mon, 17 Jul 2017 01:33:43 -0700 (PDT) Received: from localhost ([::1]:48762 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1TJ-00045K-PS for importer@patchew.org; Mon, 17 Jul 2017 04:33:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1My-0006yO-JD for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX1Mx-000288-NY for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38578) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX1Mx-00027d-Ea for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 72E344E4D9 for ; Mon, 17 Jul 2017 08:27:06 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A0B8173C3; Mon, 17 Jul 2017 08:27:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 72E344E4D9 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 72E344E4D9 From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 16:26:07 +0800 Message-Id: <1500279971-13875-8-git-send-email-peterx@redhat.com> In-Reply-To: <1500279971-13875-1-git-send-email-peterx@redhat.com> References: <1500279971-13875-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 17 Jul 2017 08:27:06 +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 v2 07/11] migration: check global params for validity 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: Laurent Vivier , Eduardo Habkost , Juan Quintela , "Dr . David Alan Gilbert" , Peter Xu , Markus Armbruster 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" Adding validity check for the migration parameters passed in via global properties. Signed-off-by: Peter Xu Reviewed-by: Juan Quintela --- migration/migration.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index 8c65054..5a7f22c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2109,6 +2109,39 @@ static void migration_instance_init(Object *obj) ms->parameters.tls_hostname =3D g_strdup(""); } =20 +static void migration_instance_post_init(Object *obj) +{ + MigrationState *ms =3D (MigrationState *)obj; + Error *err =3D NULL; + MigrationParameters params =3D { + .has_compress_level =3D true, + .compress_level =3D ms->parameters.compress_level, + .has_compress_threads =3D true, + .compress_threads =3D ms->parameters.compress_threads, + .has_decompress_threads =3D true, + .decompress_threads =3D ms->parameters.decompress_threads, + .has_cpu_throttle_initial =3D true, + .cpu_throttle_initial =3D ms->parameters.cpu_throttle_initial, + .has_cpu_throttle_increment =3D true, + .cpu_throttle_increment =3D ms->parameters.cpu_throttle_increment, + .has_max_bandwidth =3D true, + .max_bandwidth =3D ms->parameters.max_bandwidth, + .has_downtime_limit =3D true, + .downtime_limit =3D ms->parameters.downtime_limit, + .has_x_checkpoint_delay =3D true, + .x_checkpoint_delay =3D ms->parameters.x_checkpoint_delay, + .has_block_incremental =3D true, + .block_incremental =3D ms->parameters.block_incremental, + }; + + /* We have applied all the migration properties... */ + + if (!migrate_params_check(¶ms, &err)) { + error_report_err(err); + exit(1); + } +} + static const TypeInfo migration_type =3D { .name =3D TYPE_MIGRATION, /* @@ -2124,6 +2157,7 @@ static const TypeInfo migration_type =3D { .class_size =3D sizeof(MigrationClass), .instance_size =3D sizeof(MigrationState), .instance_init =3D migration_instance_init, + .instance_post_init =3D migration_instance_post_init, }; =20 static void register_migration_types(void) --=20 2.7.4 From nobody Mon Apr 29 14:46:11 2024 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.zohomail.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 1500280286295122.03775897269543; Mon, 17 Jul 2017 01:31:26 -0700 (PDT) Received: from localhost ([::1]:48753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1R7-0002Jb-2a for importer@patchew.org; Mon, 17 Jul 2017 04:31:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1N6-000764-Nt for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX1N2-0002A8-1f for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46088) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX1N1-00029l-Sa for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:11 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E0B847CE0D; Mon, 17 Jul 2017 08:27:10 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5D467C475; Mon, 17 Jul 2017 08:27:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E0B847CE0D 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=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E0B847CE0D From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 16:26:08 +0800 Message-Id: <1500279971-13875-9-git-send-email-peterx@redhat.com> In-Reply-To: <1500279971-13875-1-git-send-email-peterx@redhat.com> References: <1500279971-13875-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 17 Jul 2017 08:27:11 +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 v2 08/11] migration: remove check against colo support 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: Laurent Vivier , Eduardo Habkost , Juan Quintela , "Dr . David Alan Gilbert" , Peter Xu , Markus Armbruster , Paolo Bonzini , Hailiang Zhang 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" Since commit a15215f3 ("build: remove --enable-colo/--disable-colo"), colo is always supported. We don't need any colo_supported() now since it is always true. Removing any extra code that depends on it. CC: Paolo Bonzini CC: Hailiang Zhang Signed-off-by: Peter Xu Reviewed-by: Juan Quintela Reviewed-by: Zhang Chen --- include/migration/colo.h | 1 - migration/colo.c | 5 ----- migration/migration.c | 11 ----------- 3 files changed, 17 deletions(-) diff --git a/include/migration/colo.h b/include/migration/colo.h index be6beba..ff9874e 100644 --- a/include/migration/colo.h +++ b/include/migration/colo.h @@ -15,7 +15,6 @@ =20 #include "qemu-common.h" =20 -bool colo_supported(void); void colo_info_init(void); =20 void migrate_start_colo_process(MigrationState *s); diff --git a/migration/colo.c b/migration/colo.c index ef35f00..a425543 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -29,11 +29,6 @@ static bool vmstate_loading; =20 #define COLO_BUFFER_BASE_SIZE (4 * 1024 * 1024) =20 -bool colo_supported(void) -{ - return true; -} - bool migration_in_colo_state(void) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/migration.c b/migration/migration.c index 5a7f22c..eb750c5 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -403,9 +403,6 @@ MigrationCapabilityStatusList *qmp_query_migrate_capabi= lities(Error **errp) continue; } #endif - if (i =3D=3D MIGRATION_CAPABILITY_X_COLO && !colo_supported()) { - continue; - } if (head =3D=3D NULL) { head =3D g_malloc0(sizeof(*caps)); caps =3D head; @@ -604,14 +601,6 @@ void qmp_migrate_set_capabilities(MigrationCapabilityS= tatusList *params, continue; } #endif - if (cap->value->capability =3D=3D MIGRATION_CAPABILITY_X_COLO) { - if (!colo_supported()) { - error_setg(errp, "COLO is not currently supported, please" - " configure with --enable-colo option in orde= r to" - " support COLO feature"); - continue; - } - } s->enabled_capabilities[cap->value->capability] =3D cap->value->st= ate; } =20 --=20 2.7.4 From nobody Mon Apr 29 14:46:11 2024 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.zohomail.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 1500280379355767.0978587018651; Mon, 17 Jul 2017 01:32:59 -0700 (PDT) Received: from localhost ([::1]:48759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1Sb-0003We-UW for importer@patchew.org; Mon, 17 Jul 2017 04:32:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1NH-0007G6-Rx for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX1NG-0002NB-Ox for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57598) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX1NG-0002MQ-FO for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6500D356CD for ; Mon, 17 Jul 2017 08:27:25 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A23F7D66C; Mon, 17 Jul 2017 08:27:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6500D356CD Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6500D356CD From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 16:26:09 +0800 Message-Id: <1500279971-13875-10-git-send-email-peterx@redhat.com> In-Reply-To: <1500279971-13875-1-git-send-email-peterx@redhat.com> References: <1500279971-13875-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 17 Jul 2017 08:27:25 +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 v2 09/11] migration: provide migrate_caps_check() 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: Laurent Vivier , Eduardo Habkost , Juan Quintela , "Dr . David Alan Gilbert" , Peter Xu , Markus Armbruster 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" Abstract helper function to check migration capabilities (from the old qmp_migrate_set_capabilities). Prepare to be used somewhere else. There is side effect on the change: when applying the capabilities, we were skipping the invalid ones, but still applying the valid ones (if they are provided in the same QMP request). After this refactoring, we'll ignore all the capabilities if we detected invalid setup along the way. However, I don't think it is a problem since general users should not provide anything invalid after all. Signed-off-by: Peter Xu Reviewed-by: Juan Quintela --- migration/migration.c | 79 ++++++++++++++++++++++++++++++++++-------------= ---- 1 file changed, 53 insertions(+), 26 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index eb750c5..52db5e7 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -579,43 +579,49 @@ MigrationInfo *qmp_query_migrate(Error **errp) return info; } =20 -void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, - Error **errp) +/** + * @migration_caps_check - check capability validity + * + * @cap_list: old capability list, array of bool + * @params: new capabilities to be applied soon + * @errp: set *errp if the check failed, with reason + * + * Returns true if check passed, otherwise false. + */ +static bool migrate_caps_check(bool *cap_list, + MigrationCapabilityStatusList *params, + Error **errp) { - MigrationState *s =3D migrate_get_current(); MigrationCapabilityStatusList *cap; - bool old_postcopy_cap =3D migrate_postcopy_ram(); + bool old_postcopy_cap; =20 - if (migration_is_setup_or_active(s->state)) { - error_setg(errp, QERR_MIGRATION_ACTIVE); - return; - } + old_postcopy_cap =3D cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM]; =20 for (cap =3D params; cap; cap =3D cap->next) { + cap_list[cap->value->capability] =3D cap->value->state; + } + #ifndef CONFIG_LIVE_BLOCK_MIGRATION - if (cap->value->capability =3D=3D MIGRATION_CAPABILITY_BLOCK - && cap->value->state) { - error_setg(errp, "QEMU compiled without old-style (blk/-b, inc= /-i) " - "block migration"); - error_append_hint(errp, "Use drive_mirror+NBD instead.\n"); - continue; - } -#endif - s->enabled_capabilities[cap->value->capability] =3D cap->value->st= ate; + if (cap_list[MIGRATION_CAPABILITY_BLOCK]) { + error_setg(errp, "QEMU compiled without old-style (blk/-b, inc/-i)= " + "block migration"); + error_append_hint(errp, "Use drive_mirror+NBD instead.\n"); + return false; } +#endif =20 - if (migrate_postcopy_ram()) { - if (migrate_use_compression()) { + if (cap_list[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + if (cap_list[MIGRATION_CAPABILITY_COMPRESS]) { /* The decompression threads asynchronously write into RAM * rather than use the atomic copies needed to avoid * userfaulting. It should be possible to fix the decompressi= on * threads for compatibility in future. */ - error_report("Postcopy is not currently compatible with " - "compression"); - s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D - false; + error_setg(errp, "Postcopy is not currently compatible " + "with compression"); + return false; } + /* This check is reasonably expensive, so only when it's being * set the first time, also it's only the destination that needs * special support. @@ -625,11 +631,32 @@ void qmp_migrate_set_capabilities(MigrationCapability= StatusList *params, /* postcopy_ram_supported_by_host will have emitted a more * detailed message */ - error_report("Postcopy is not supported"); - s->enabled_capabilities[MIGRATION_CAPABILITY_POSTCOPY_RAM] =3D - false; + error_setg(errp, "Postcopy is not supported"); + return false; } } + + return true; +} + +void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, + Error **errp) +{ + MigrationState *s =3D migrate_get_current(); + MigrationCapabilityStatusList *cap; + + if (migration_is_setup_or_active(s->state)) { + error_setg(errp, QERR_MIGRATION_ACTIVE); + return; + } + + if (!migrate_caps_check(s->enabled_capabilities, params, errp)) { + return; + } + + for (cap =3D params; cap; cap =3D cap->next) { + s->enabled_capabilities[cap->value->capability] =3D cap->value->st= ate; + } } =20 /* --=20 2.7.4 From nobody Mon Apr 29 14:46:11 2024 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.zohomail.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 150028040097459.70367703124896; Mon, 17 Jul 2017 01:33:20 -0700 (PDT) Received: from localhost ([::1]:48760 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1Sw-0003mf-Hg for importer@patchew.org; Mon, 17 Jul 2017 04:33:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1NW-0007Sd-AM for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX1NS-0002Rp-BE for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39846) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX1NS-0002RS-3V for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1E53C4E4D9 for ; Mon, 17 Jul 2017 08:27:37 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id C72E277EAD; Mon, 17 Jul 2017 08:27:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1E53C4E4D9 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1E53C4E4D9 From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 16:26:10 +0800 Message-Id: <1500279971-13875-11-git-send-email-peterx@redhat.com> In-Reply-To: <1500279971-13875-1-git-send-email-peterx@redhat.com> References: <1500279971-13875-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 17 Jul 2017 08:27:37 +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 v2 10/11] migration: provide migrate_cap_add() 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: Laurent Vivier , Eduardo Habkost , Juan Quintela , "Dr . David Alan Gilbert" , Peter Xu , Markus Armbruster 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" Abstracted from migrate_set_block_enabled() to allocate MigrationCapabilityStatusList properly. Signed-off-by: Peter Xu Reviewed-by: Juan Quintela --- migration/migration.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 52db5e7..300f84d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -833,14 +833,27 @@ void migrate_set_state(int *state, int old_state, int= new_state) } } =20 -void migrate_set_block_enabled(bool value, Error **errp) +static MigrationCapabilityStatusList *migrate_cap_add( + MigrationCapabilityStatusList *head, + MigrationCapability index, + bool state) { MigrationCapabilityStatusList *cap; =20 cap =3D g_new0(MigrationCapabilityStatusList, 1); cap->value =3D g_new0(MigrationCapabilityStatus, 1); - cap->value->capability =3D MIGRATION_CAPABILITY_BLOCK; - cap->value->state =3D value; + cap->value->capability =3D index; + cap->value->state =3D state; + cap->next =3D head; + + return cap; +} + +void migrate_set_block_enabled(bool value, Error **errp) +{ + MigrationCapabilityStatusList *cap; + + cap =3D migrate_cap_add(NULL, MIGRATION_CAPABILITY_BLOCK, value); qmp_migrate_set_capabilities(cap, errp); qapi_free_MigrationCapabilityStatusList(cap); } --=20 2.7.4 From nobody Mon Apr 29 14:46:11 2024 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.zohomail.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 1500280562221496.9355630851703; Mon, 17 Jul 2017 01:36:02 -0700 (PDT) Received: from localhost ([::1]:48778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1VZ-00063B-0x for importer@patchew.org; Mon, 17 Jul 2017 04:36:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1NW-0007T6-Rt for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX1NW-0002Tp-2J for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59726) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX1NV-0002T4-Se for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:27:42 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D90417CB80 for ; Mon, 17 Jul 2017 08:27:40 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-12-53.pek2.redhat.com [10.72.12.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id AACE177FEF; Mon, 17 Jul 2017 08:27:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D90417CB80 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=peterx@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D90417CB80 From: Peter Xu To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 16:26:11 +0800 Message-Id: <1500279971-13875-12-git-send-email-peterx@redhat.com> In-Reply-To: <1500279971-13875-1-git-send-email-peterx@redhat.com> References: <1500279971-13875-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 17 Jul 2017 08:27:41 +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 v2 11/11] migration: check global caps for validity 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: Laurent Vivier , Eduardo Habkost , Juan Quintela , "Dr . David Alan Gilbert" , Peter Xu , Markus Armbruster 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" Checks validity for all the capabilities that we enabled with command line. Stop the VM if detected anything wrong. Signed-off-by: Peter Xu Reviewed-by: Juan Quintela --- migration/migration.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 300f84d..b2667d0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2142,6 +2142,9 @@ static void migration_instance_post_init(Object *obj) { MigrationState *ms =3D (MigrationState *)obj; Error *err =3D NULL; + MigrationCapabilityStatusList *head =3D NULL; + /* Assuming all off */ + bool cap_list[MIGRATION_CAPABILITY__MAX] =3D { 0 }; MigrationParameters params =3D { .has_compress_level =3D true, .compress_level =3D ms->parameters.compress_level, @@ -2162,13 +2165,35 @@ static void migration_instance_post_init(Object *ob= j) .has_block_incremental =3D true, .block_incremental =3D ms->parameters.block_incremental, }; + int i; =20 /* We have applied all the migration properties... */ =20 if (!migrate_params_check(¶ms, &err)) { + goto error; + } + + for (i =3D 0; i < MIGRATION_CAPABILITY__MAX; i++) { + if (ms->enabled_capabilities[i]) { + head =3D migrate_cap_add(head, i, true); + } + } + + if (!migrate_caps_check(cap_list, head, &err)) { + goto error; + } + + qapi_free_MigrationCapabilityStatusList(head); + return; + +error: + if (head) { + qapi_free_MigrationCapabilityStatusList(head); + } + if (err) { error_report_err(err); - exit(1); } + exit(1); } =20 static const TypeInfo migration_type =3D { --=20 2.7.4