From patchwork Mon Dec 5 20:00: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: 129410 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 DC7B31007D5 for ; Tue, 6 Dec 2011 07:02:24 +1100 (EST) Received: from localhost ([::1]:43397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXek2-0006Me-9h for incoming@patchwork.ozlabs.org; Mon, 05 Dec 2011 15:02:22 -0500 Received: from eggs.gnu.org ([140.186.70.92]:41861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXein-0003VV-9N for qemu-devel@nongnu.org; Mon, 05 Dec 2011 15:01:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RXeii-00063F-6m for qemu-devel@nongnu.org; Mon, 05 Dec 2011 15:01:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXeih-000637-Uv for qemu-devel@nongnu.org; Mon, 05 Dec 2011 15:01:00 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pB5K0vK6006965 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 5 Dec 2011 15:00:58 -0500 Received: from localhost (ovpn-113-50.phx2.redhat.com [10.3.113.50]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pB5K0u8n012226; Mon, 5 Dec 2011 15:00:57 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Mon, 5 Dec 2011 18:00:25 -0200 Message-Id: <1323115226-16817-16-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1323115226-16817-1-git-send-email-lcapitulino@redhat.com> References: <1323115226-16817-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 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 15/16] qapi: Convert migrate_set_downtime 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 | 13 ++++--------- migration.h | 3 --- qapi-schema.json | 13 +++++++++++++ qmp-commands.hx | 5 +---- 7 files changed, 26 insertions(+), 18 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index e48c2ca..6ba694d 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -801,8 +801,7 @@ ETEXI .args_type = "value:T", .params = "value", .help = "set maximum tolerated downtime (in seconds) for migrations", - .user_print = monitor_user_noop, - .mhandler.cmd_new = do_migrate_set_downtime, + .mhandler.cmd = hmp_migrate_set_downtime, }, STEXI diff --git a/hmp.c b/hmp.c index 92bb08f..04e6b73 100644 --- a/hmp.c +++ b/hmp.c @@ -667,3 +667,9 @@ void hmp_migrate_cancel(Monitor *mon, const QDict *qdict) { qmp_migrate_cancel(NULL); } + +void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict) +{ + double value = qdict_get_double(qdict, "value"); + qmp_migrate_set_downtime(value, NULL); +} diff --git a/hmp.h b/hmp.h index 2b0c1e4..9182622 100644 --- a/hmp.h +++ b/hmp.h @@ -47,5 +47,6 @@ void hmp_balloon(Monitor *mon, const QDict *qdict); 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); #endif diff --git a/migration.c b/migration.c index fa603d6..a563162 100644 --- a/migration.c +++ b/migration.c @@ -490,14 +490,9 @@ int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data) return 0; } -int do_migrate_set_downtime(Monitor *mon, const QDict *qdict, - QObject **ret_data) +void qmp_migrate_set_downtime(double value, Error **errp) { - double d; - - d = qdict_get_double(qdict, "value") * 1e9; - d = MAX(0, MIN(UINT64_MAX, d)); - max_downtime = (uint64_t)d; - - return 0; + value *= 1e9; + value = MAX(0, MIN(UINT64_MAX, value)); + max_downtime = (uint64_t)value; } diff --git a/migration.h b/migration.h index ff2e40b..539f8f1 100644 --- a/migration.h +++ b/migration.h @@ -46,9 +46,6 @@ int do_migrate_set_speed(Monitor *mon, const QDict *qdict, QObject **ret_data); uint64_t migrate_max_downtime(void); -int do_migrate_set_downtime(Monitor *mon, const QDict *qdict, - QObject **ret_data); - void do_info_migrate_print(Monitor *mon, const QObject *data); void do_info_migrate(Monitor *mon, QObject **ret_data); diff --git a/qapi-schema.json b/qapi-schema.json index d638f12..d9b9fa1 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -1140,3 +1140,16 @@ # Since: 0.14.0 ## { 'command': 'migrate_cancel' } + +## +# @migrate_set_downtime +# +# Set maximum tolerated downtime for migration. +# +# @value: maximum downtime in seconds +# +# Returns: nothing on success +# +# Since: 0.14.0 +## +{ 'command': 'migrate_set_downtime', 'data': {'value': 'number'} } diff --git a/qmp-commands.hx b/qmp-commands.hx index 5eb4b76..b4cadeb 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -518,10 +518,7 @@ EQMP { .name = "migrate_set_downtime", .args_type = "value:T", - .params = "value", - .help = "set maximum tolerated downtime (in seconds) for migrations", - .user_print = monitor_user_noop, - .mhandler.cmd_new = do_migrate_set_downtime, + .mhandler.cmd_new = qmp_marshal_input_migrate_set_downtime, }, SQMP