From nobody Mon Feb 9 12:26:51 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.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 1500385597133288.95633568200753; Tue, 18 Jul 2017 06:46:37 -0700 (PDT) Received: from localhost ([::1]:56600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXSpb-0004zP-Tt for importer@patchew.org; Tue, 18 Jul 2017 09:46:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXSkv-0000Bt-Pp for qemu-devel@nongnu.org; Tue, 18 Jul 2017 09:41:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXSkt-0007T9-7i for qemu-devel@nongnu.org; Tue, 18 Jul 2017 09:41:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59584) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dXSkm-0007LW-ER; Tue, 18 Jul 2017 09:41:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6228A7F6B9; Tue, 18 Jul 2017 13:41:31 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-60.ams2.redhat.com [10.36.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E2D8E7F8C5; Tue, 18 Jul 2017 13:41:30 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 11233113866C; Tue, 18 Jul 2017 15:41:27 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6228A7F6B9 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=armbru@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6228A7F6B9 From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 18 Jul 2017 15:41:25 +0200 Message-Id: <1500385286-21142-10-git-send-email-armbru@redhat.com> In-Reply-To: <1500385286-21142-1-git-send-email-armbru@redhat.com> References: <1500385286-21142-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 18 Jul 2017 13:41:31 +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 for-2.10 09/10] migration: Unshare MigrationParameters struct for now 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: kwolf@redhat.com, qemu-block@nongnu.org, quintela@redhat.com, dgilbert@redhat.com, mreitz@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" Commit de63ab6 "migrate: Share common MigrationParameters struct" reused MigrationParameters for the arguments of migrate-set-parameters, with the following rationale: It is rather verbose, and slightly error-prone, to repeat the same set of parameters for input (migrate-set-parameters) as for output (query-migrate-parameters), where the only difference is whether the members are optional. We can just document that the optional members will always be present on output, and then share a common struct between both commands. The next patch can then reduce the amount of code needed on input. I need to unshare them to correct a design flaw in a stupid, but minimally invasive way, in the next commit. We can restore the sharing when we redo that patch in a less stupid way. Add a suitable TODO comment. Note that I revert only the sharing part of commit de63ab6, not the part that made the members of query-migrate-parameters' result optional. The schema (and thus introspection) remains inaccurate for query-migrate-parameters. If we decide not to restore the sharing, we should revert that part, too. Signed-off-by: Markus Armbruster Reviewed-by: Daniel P. Berrange Reviewed-by: Eric Blake --- hmp.c | 4 +-- migration/migration.c | 12 +++++--- qapi-schema.json | 85 ++++++++++++++++++++++++++++++++++++++++++++++-= ---- 3 files changed, 87 insertions(+), 14 deletions(-) diff --git a/hmp.c b/hmp.c index 2b2db3c..0a5de75 100644 --- a/hmp.c +++ b/hmp.c @@ -1511,7 +1511,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QD= ict *qdict) const char *param =3D qdict_get_str(qdict, "parameter"); const char *valuestr =3D qdict_get_str(qdict, "value"); Visitor *v =3D string_input_visitor_new(valuestr); - MigrationParameters *p =3D g_new0(MigrationParameters, 1); + MigrateSetParameters *p =3D g_new0(MigrateSetParameters, 1); uint64_t valuebw =3D 0; Error *err =3D NULL; int i, ret; @@ -1589,7 +1589,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QD= ict *qdict) } =20 cleanup: - qapi_free_MigrationParameters(p); + qapi_free_MigrateSetParameters(p); visit_free(v); if (err) { error_report_err(err); diff --git a/migration/migration.c b/migration/migration.c index d0a1d13..f6a9443 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -644,7 +644,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilitySt= atusList *params, } } =20 -void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp) +void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) { MigrationState *s =3D migrate_get_current(); =20 @@ -704,7 +704,11 @@ void qmp_migrate_set_parameters(MigrationParameters *p= arams, Error **errp) "is invalid, it should be positive"); } =20 - /* TODO use QAPI_CLONE() instead of duplicating it inline */ + /* + * TODO if we fuse MigrateSetParameters back into + * MigrationParameters, use QAPI_CLONE() instead of duplicating it + * inline + */ if (params->has_compress_level) { s->parameters.compress_level =3D params->compress_level; } @@ -1165,7 +1169,7 @@ int64_t qmp_query_migrate_cache_size(Error **errp) =20 void qmp_migrate_set_speed(int64_t value, Error **errp) { - MigrationParameters p =3D { + MigrateSetParameters p =3D { .has_max_bandwidth =3D true, .max_bandwidth =3D value, }; @@ -1185,7 +1189,7 @@ void qmp_migrate_set_downtime(double value, Error **e= rrp) value *=3D 1000; /* Convert to milliseconds */ value =3D MAX(0, MIN(INT64_MAX, value)); =20 - MigrationParameters p =3D { + MigrateSetParameters p =3D { .has_downtime_limit =3D true, .downtime_limit =3D value, }; diff --git a/qapi-schema.json b/qapi-schema.json index 7b75cf1..b5ec942 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1035,6 +1035,77 @@ 'downtime-limit', 'x-checkpoint-delay', 'block-incremental' ] } =20 ## +# @MigrateSetParameters: +# +# @compress-level: compression level +# +# @compress-threads: compression thread count +# +# @decompress-threads: decompression thread count +# +# @cpu-throttle-initial: Initial percentage of time guest cpus are +# throttled when migration auto-converge is activat= ed. +# The default value is 20. (Since 2.7) +# +# @cpu-throttle-increment: throttle percentage increase each time +# auto-converge detects that migration is not mak= ing +# progress. The default value is 10. (Since 2.7) +# +# @tls-creds: ID of the 'tls-creds' object that provides credentials +# for establishing a TLS connection over the migration data +# channel. On the outgoing side of the migration, the credenti= als +# must be for a 'client' endpoint, while for the incoming side= the +# credentials must be for a 'server' endpoint. Setting this +# to a non-empty string enables TLS for all migrations. +# An empty string means that QEMU will use plain text mode for +# migration, rather than TLS (Since 2.9) +# Previously (since 2.7), this was reported by omitting +# tls-creds instead. +# +# @tls-hostname: hostname of the target host for the migration. This +# is required when using x509 based TLS credentials and the +# migration URI does not already include a hostname. For +# example if using fd: or exec: based migration, the +# hostname must be provided so that the server's x509 +# certificate identity can be validated. (Since 2.7) +# An empty string means that QEMU will use the hostname +# associated with the migration URI, if any. (Since 2.9) +# Previously (since 2.7), this was reported by omitting +# tls-hostname instead. +# +# @max-bandwidth: to set maximum speed for migration. maximum speed in +# bytes per second. (Since 2.8) +# +# @downtime-limit: set maximum tolerated downtime for migration. maximum +# downtime in milliseconds (Since 2.8) +# +# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since= 2.8) +# +# @block-incremental: Affects how much storage is migrated when the +# block migration capability is enabled. When false, the entire +# storage backing chain is migrated into a flattened image at +# the destination; when true, only the active qcow2 layer is +# migrated and the destination must already have access to the +# same backing chain as was used on the source. (since 2.10) +# +# Since: 2.4 +## +# TODO either fuse back into MigrationParameters, or make +# MigrationParameters members mandatory +{ 'struct': 'MigrateSetParameters', + 'data': { '*compress-level': 'int', + '*compress-threads': 'int', + '*decompress-threads': 'int', + '*cpu-throttle-initial': 'int', + '*cpu-throttle-increment': 'int', + '*tls-creds': 'str', + '*tls-hostname': 'str', + '*max-bandwidth': 'int', + '*downtime-limit': 'int', + '*x-checkpoint-delay': 'int', + '*block-incremental': 'bool' } } + +## # @migrate-set-parameters: # # Set various migration parameters. @@ -1048,13 +1119,12 @@ # ## { 'command': 'migrate-set-parameters', 'boxed': true, - 'data': 'MigrationParameters' } + 'data': 'MigrateSetParameters' } =20 ## # @MigrationParameters: # -# Optional members can be omitted on input ('migrate-set-parameters') -# but members will always be present on output. +# The optional members aren't actually optional. # # @compress-level: compression level # @@ -1063,19 +1133,18 @@ # @decompress-threads: decompression thread count # # @cpu-throttle-initial: Initial percentage of time guest cpus are -# throttledwhen migration auto-converge is activate= d. -# The default value is 20. (Since 2.7) +# throttled when migration auto-converge is activat= ed. +# (Since 2.7) # # @cpu-throttle-increment: throttle percentage increase each time # auto-converge detects that migration is not mak= ing -# progress. The default value is 10. (Since 2.7) +# progress. (Since 2.7) # # @tls-creds: ID of the 'tls-creds' object that provides credentials # for establishing a TLS connection over the migration data # channel. On the outgoing side of the migration, the credenti= als # must be for a 'client' endpoint, while for the incoming side= the -# credentials must be for a 'server' endpoint. Setting this -# to a non-empty string enables TLS for all migrations. +# credentials must be for a 'server' endpoint. # An empty string means that QEMU will use plain text mode for # migration, rather than TLS (Since 2.7) # Note: 2.8 reports this by omitting tls-creds instead. --=20 2.7.5