From patchwork Mon Nov 28 18:11:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 128037 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C670CB6F68 for ; Tue, 29 Nov 2011 05:12:46 +1100 (EST) Received: from localhost ([::1]:38911 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RV5h5-0004H7-SV for incoming@patchwork.ozlabs.org; Mon, 28 Nov 2011 13:12:43 -0500 Received: from eggs.gnu.org ([140.186.70.92]:55297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RV5gc-0003pA-3a for qemu-devel@nongnu.org; Mon, 28 Nov 2011 13:12:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RV5gR-0008LP-6z for qemu-devel@nongnu.org; Mon, 28 Nov 2011 13:12:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RV5gQ-0008L3-Iv for qemu-devel@nongnu.org; Mon, 28 Nov 2011 13:12:03 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pASIC0UU009128 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 28 Nov 2011 13:12:00 -0500 Received: from localhost (ovpn-113-91.phx2.redhat.com [10.3.113.91]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id pASIBx8E031721; Mon, 28 Nov 2011 13:12:00 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Mon, 28 Nov 2011 16:11:25 -0200 Message-Id: <1322503885-5913-17-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1322503885-5913-1-git-send-email-lcapitulino@redhat.com> References: <1322503885-5913-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com, mdroth@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH 16/16] qapi: Convert migrate_set_speed 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: Luiz Capitulino --- hmp-commands.hx | 3 +-- hmp.c | 6 ++++++ hmp.h | 1 + migration.c | 12 ++++-------- migration.h | 2 -- qapi-schema.json | 15 +++++++++++++++ qmp-commands.hx | 5 +---- 7 files changed, 28 insertions(+), 16 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 4a79978..904eea6 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -786,8 +786,7 @@ ETEXI .params = "value", .help = "set maximum speed (in bytes) for migrations. " "Defaults to MB if no size suffix is specified, ie. B/K/M/G/T", - .user_print = monitor_user_noop, - .mhandler.cmd_new = do_migrate_set_speed, + .mhandler.cmd = hmp_migrate_set_speed, }, STEXI diff --git a/hmp.c b/hmp.c index d7577b7..4c330e2 100644 --- a/hmp.c +++ b/hmp.c @@ -663,3 +663,9 @@ void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict) double value = qdict_get_double(qdict, "value"); qmp_migrate_set_downtime(value, NULL); } + +void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict) +{ + int64_t value = qdict_get_int(qdict, "value"); + qmp_migrate_set_speed(value, NULL); +} diff --git a/hmp.h b/hmp.h index 9182622..093242d 100644 --- a/hmp.h +++ b/hmp.h @@ -48,5 +48,6 @@ void hmp_block_resize(Monitor *mon, const QDict *qdict); void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict); void hmp_migrate_cancel(Monitor *mon, const QDict *qdict); void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict); +void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict); #endif diff --git a/migration.c b/migration.c index a563162..75d4f02 100644 --- a/migration.c +++ b/migration.c @@ -473,21 +473,17 @@ void qmp_migrate_cancel(Error **errp) migrate_fd_cancel(migrate_get_current()); } -int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data) +void qmp_migrate_set_speed(int64_t value, Error **errp) { - int64_t d; MigrationState *s; - d = qdict_get_int(qdict, "value"); - if (d < 0) { - d = 0; + if (value < 0) { + value = 0; } s = migrate_get_current(); - s->bandwidth_limit = d; + s->bandwidth_limit = value; qemu_file_set_rate_limit(s->file, s->bandwidth_limit); - - return 0; } void qmp_migrate_set_downtime(double value, Error **errp) diff --git a/migration.h b/migration.h index 539f8f1..999d60f 100644 --- a/migration.h +++ b/migration.h @@ -42,8 +42,6 @@ int qemu_start_incoming_migration(const char *uri); int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data); -int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data); - uint64_t migrate_max_downtime(void); void do_info_migrate_print(Monitor *mon, const QObject *data); diff --git a/qapi-schema.json b/qapi-schema.json index 5118439..b6773b7 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1139,3 +1139,18 @@ # Since: 0.14.0 ## { 'command': 'migrate_set_downtime', 'data': {'value': 'number'} } + +## +# @migrate_set_speed +# +# Set maximum speed for migration. +# +# @value: maximum speed in bytes. +# +# Returns: nothing on success +# +# Notes: A value lesser than zero will be automatically round up to zero. +# +# Since: 0.14.0 +## +{ 'command': 'migrate_set_speed', 'data': {'value': 'int'} } diff --git a/qmp-commands.hx b/qmp-commands.hx index 9c1bf93..35f99ef 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -492,10 +492,7 @@ EQMP { .name = "migrate_set_speed", .args_type = "value:o", - .params = "value", - .help = "set maximum speed (in bytes) for migrations", - .user_print = monitor_user_noop, - .mhandler.cmd_new = do_migrate_set_speed, + .mhandler.cmd_new = qmp_marshal_input_migrate_set_speed, }, SQMP