From patchwork Mon Aug 7 14:45:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 9885541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 04038603B4 for ; Mon, 7 Aug 2017 15:03:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E930227D0E for ; Mon, 7 Aug 2017 15:03:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDA7E2869F; Mon, 7 Aug 2017 15:03:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7A58127D0E for ; Mon, 7 Aug 2017 15:03:14 +0000 (UTC) Received: from localhost ([::1]:37772 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dejYn-0004hw-Oh for patchwork-qemu-devel@patchwork.kernel.org; Mon, 07 Aug 2017 11:03:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dejJ4-0007Mx-6C for qemu-devel@nongnu.org; Mon, 07 Aug 2017 10:47:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dejIo-0003tn-5N for qemu-devel@nongnu.org; Mon, 07 Aug 2017 10:46:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58032) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dejIU-0003YK-7p; Mon, 07 Aug 2017 10:46:22 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A62E7F40C; Mon, 7 Aug 2017 14:46:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2A62E7F40C 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=fail smtp.mailfrom=armbru@redhat.com Received: from blackfin.pond.sub.org (ovpn-116-254.ams2.redhat.com [10.36.116.254]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E510795212; Mon, 7 Aug 2017 14:46:17 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 46BE911386D8; Mon, 7 Aug 2017 16:46:00 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 7 Aug 2017 16:45:22 +0200 Message-Id: <1502117160-24655-19-git-send-email-armbru@redhat.com> In-Reply-To: <1502117160-24655-1-git-send-email-armbru@redhat.com> References: <1502117160-24655-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 07 Aug 2017 14:46:21 +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] [RFC PATCH 18/56] migration: Make parameter max-bandwidth unsigned in QAPI/QMP 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, famz@redhat.com, qemu-block@nongnu.org, quintela@redhat.com, jcody@redhat.com, dgilbert@redhat.com, mreitz@redhat.com, marcandre.lureau@redhat.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Byte rates should use QAPI type 'size' (uint64_t). migrate_set_speed's parameter @value and member @max-bandwidth of MigrationParameters and MigrateSetParameters are 'int' (int64_t). Change them all to 'size'. migrate_set_speed and migrate-set-parameters now accept bandwidth values between 2^63 and SIZE_MAX (commonly 2^64-1). They accept negative values as before, because that's how the QObject input visitor works for backward compatibility. So does HMP's migrate_set_speed, except it continues to reject negative values. query-migrate-parameters now reports bandwidth values above 2^63-1 correctly instead of their (negative) two's complement. So does HMP's "info migrate_params". Signed-off-by: Markus Armbruster Reviewed-by: Juan Quintela --- hmp.c | 2 +- migration/migration.c | 9 ++++----- qapi-schema.json | 6 +++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/hmp.c b/hmp.c index 184fb8b..9bcdcb3 100644 --- a/hmp.c +++ b/hmp.c @@ -322,7 +322,7 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict) MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_HOSTNAME], params->tls_hostname); assert(params->has_max_bandwidth); - monitor_printf(mon, "%s: %" PRId64 " bytes/second\n", + monitor_printf(mon, "%s: %" PRIu64 " bytes/second\n", MigrationParameter_lookup[MIGRATION_PARAMETER_MAX_BANDWIDTH], params->max_bandwidth); assert(params->has_downtime_limit); diff --git a/migration/migration.c b/migration/migration.c index 2d7f3a2..0b47371 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -716,8 +716,7 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp) return false; } - if (params->has_max_bandwidth && - (params->max_bandwidth < 0 || params->max_bandwidth > SIZE_MAX)) { + if (params->has_max_bandwidth && 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 false; @@ -1311,7 +1310,7 @@ uint64_t qmp_query_migrate_cache_size(Error **errp) return migrate_xbzrle_cache_size(); } -void qmp_migrate_set_speed(int64_t value, Error **errp) +void qmp_migrate_set_speed(uint64_t value, Error **errp) { MigrateSetParameters p = { .has_max_bandwidth = true, @@ -2179,8 +2178,8 @@ static Property migration_properties[] = { 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_UINT64("x-max-bandwidth", MigrationState, + parameters.max_bandwidth, MAX_THROTTLE), DEFINE_PROP_INT64("x-downtime-limit", MigrationState, parameters.downtime_limit, DEFAULT_MIGRATE_SET_DOWNTIME), diff --git a/qapi-schema.json b/qapi-schema.json index 2eee676..c18e574 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1116,7 +1116,7 @@ '*cpu-throttle-increment': 'int', '*tls-creds': 'StrOrNull', '*tls-hostname': 'StrOrNull', - '*max-bandwidth': 'int', + '*max-bandwidth': 'size', '*downtime-limit': 'int', '*x-checkpoint-delay': 'int', '*block-incremental': 'bool' } } @@ -1200,7 +1200,7 @@ '*cpu-throttle-increment': 'int', '*tls-creds': 'str', '*tls-hostname': 'str', - '*max-bandwidth': 'int', + '*max-bandwidth': 'size', '*downtime-limit': 'int', '*x-checkpoint-delay': 'int', '*block-incremental': 'bool' } } @@ -2852,7 +2852,7 @@ # <- { "return": {} } # ## -{ 'command': 'migrate_set_speed', 'data': {'value': 'int'} } +{ 'command': 'migrate_set_speed', 'data': {'value': 'size'} } ## # @migrate-set-cache-size: