aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2011-09-26 17:43:54 -0300
committerKevin Wolf <kwolf@redhat.com>2011-10-11 09:42:45 +0200
commitf04ef601007743499b11c12381a4ca7258199555 (patch)
treed9082181974932a6807ba501a8d9c3cde5960c1b
parent9fb118e6b3d1744c6093588b3db613bc25d64e00 (diff)
QMP: query-status: Add 'io-status' key
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 <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block.c12
-rw-r--r--qmp-commands.hx6
2 files changed, 18 insertions, 0 deletions
diff --git a/block.c b/block.c
index 92ec2c3b4e..40621b1acb 100644
--- a/block.c
+++ b/block.c
@@ -1893,6 +1893,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;
@@ -1915,6 +1921,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 ea96191c12..9c11e87ddb 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -1154,6 +1154,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:
@@ -1161,6 +1165,7 @@ Example:
<- {
"return":[
{
+ "io-status": "ok",
"device":"ide0-hd0",
"locked":false,
"removable":false,
@@ -1173,6 +1178,7 @@ Example:
"type":"unknown"
},
{
+ "io-status": "ok",
"device":"ide1-cd0",
"locked":false,
"removable":true,