From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49605) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6nsO-0005Q4-M4 for qemu-devel@nongnu.org; Thu, 22 Sep 2011 14:20:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R6nsN-0007gE-8G for qemu-devel@nongnu.org; Thu, 22 Sep 2011 14:20:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29809) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6nsN-0007g6-0A for qemu-devel@nongnu.org; Thu, 22 Sep 2011 14:19:59 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8MIJwo1026080 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 22 Sep 2011 14:19:58 -0400 From: Luiz Capitulino Date: Thu, 22 Sep 2011 15:19:43 -0300 Message-Id: <1316715584-25557-6-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1316715584-25557-1-git-send-email-lcapitulino@redhat.com> References: <1316715584-25557-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 5/6] QMP: query-status: Add 'io-status' key List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kwolf@redhat.com Cc: armbru@redhat.com, qemu-devel@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 fbd90b4..958a937 100644 --- a/block.c +++ b/block.c @@ -1890,6 +1890,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; @@ -1912,6 +1918,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..2b4a577 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 + (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, -- 1.7.7.rc0.72.g4b5ea