From patchwork Mon Sep 26 20:43:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 116479 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 AEA71B6F7C for ; Tue, 27 Sep 2011 06:44:37 +1000 (EST) Received: from localhost ([::1]:53052 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8I2T-0002lm-Bo for incoming@patchwork.ozlabs.org; Mon, 26 Sep 2011 16:44:33 -0400 Received: from eggs.gnu.org ([140.186.70.92]:37898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8I28-0002Ou-KN for qemu-devel@nongnu.org; Mon, 26 Sep 2011 16:44:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R8I26-0006gP-KU for qemu-devel@nongnu.org; Mon, 26 Sep 2011 16:44:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27047) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8I26-0006fw-2j for qemu-devel@nongnu.org; Mon, 26 Sep 2011 16:44:10 -0400 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 p8QKi8SC006521 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 26 Sep 2011 16:44:08 -0400 Received: from localhost (ovpn-113-52.phx2.redhat.com [10.3.113.52]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p8QKi7BY012626; Mon, 26 Sep 2011 16:44:07 -0400 From: Luiz Capitulino To: kwolf@redhat.com Date: Mon, 26 Sep 2011 17:43:54 -0300 Message-Id: <1317069835-28815-6-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1317069835-28815-1-git-send-email-lcapitulino@redhat.com> References: <1317069835-28815-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: zwu.kernel@gmail.com, armbru@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 5/6] QMP: query-status: Add 'io-status' key 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 Contains the I/O status for the given device. The key is only present if the device supports it and the VM is configured to stop on errors. Please, check the documentation being added in this commit for more information. Signed-off-by: Luiz Capitulino --- block.c | 12 ++++++++++++ qmp-commands.hx | 6 ++++++ 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/block.c b/block.c index 96b047b..7053c80 100644 --- a/block.c +++ b/block.c @@ -1891,6 +1891,12 @@ void bdrv_info_print(Monitor *mon, const QObject *data) qlist_iter(qobject_to_qlist(data), bdrv_print_dict, mon); } +static const char *const io_status_name[BDRV_IOS_MAX] = { + [BDRV_IOS_OK] = "ok", + [BDRV_IOS_FAILED] = "failed", + [BDRV_IOS_ENOSPC] = "nospace", +}; + void bdrv_info(Monitor *mon, QObject **ret_data) { QList *bs_list; @@ -1913,6 +1919,12 @@ void bdrv_info(Monitor *mon, QObject **ret_data) qdict_put(bs_dict, "tray-open", qbool_from_int(bdrv_dev_is_tray_open(bs))); } + + if (bdrv_iostatus_is_enabled(bs)) { + qdict_put(bs_dict, "io-status", + qstring_from_str(io_status_name[bs->iostatus])); + } + if (bs->drv) { QObject *obj; diff --git a/qmp-commands.hx b/qmp-commands.hx index d83bce5..34cc353 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -1145,6 +1145,10 @@ Each json-object contain the following: "tftp", "vdi", "vmdk", "vpc", "vvfat" - "backing_file": backing file name (json-string, optional) - "encrypted": true if encrypted, false otherwise (json-bool) +- "io-status": I/O operation status, only present if the device supports it + and the VM is configured to stop on errors. It's always reset + to "ok" when the "cont" command is issued (json_string, optional) + - Possible values: "ok", "failed", "nospace" Example: @@ -1152,6 +1156,7 @@ Example: <- { "return":[ { + "io-status": "ok", "device":"ide0-hd0", "locked":false, "removable":false, @@ -1164,6 +1169,7 @@ Example: "type":"unknown" }, { + "io-status": "ok", "device":"ide1-cd0", "locked":false, "removable":true,