diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2011-09-26 17:43:50 -0300 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2011-10-11 09:41:47 +0200 |
commit | 28a7282a5d5a15527e66d3a93c93c4ccc292f694 (patch) | |
tree | 423bbb87fff9eb708c120e8b791cd69d0c78278d /block.h | |
parent | 449c184ed23c6238da7fcc8b965c8fcc865d72a9 (diff) | |
download | qemu-28a7282a5d5a15527e66d3a93c93c4ccc292f694.tar.gz qemu-28a7282a5d5a15527e66d3a93c93c4ccc292f694.tar.bz2 qemu-28a7282a5d5a15527e66d3a93c93c4ccc292f694.zip |
block: Keep track of devices' I/O status
This commit adds support to the BlockDriverState type to keep track
of devices' I/O status.
There are three possible status: BDRV_IOS_OK (no error), BDRV_IOS_ENOSPC
(no space error) and BDRV_IOS_FAILED (any other error). The distinction
between no space and other errors is important because a management
application may want to watch for no space in order to extend the
space assigned to the VM and put it to run again.
Qemu devices supporting the I/O status feature have to enable it
explicitly by calling bdrv_iostatus_enable() _and_ have to be
configured to stop the VM on errors (ie. werror=stop|enospc or
rerror=stop).
In case of multiple errors being triggered in sequence only the first
one is stored. The I/O status is always reset to BDRV_IOS_OK when the
'cont' command is issued.
Next commits will add support to some devices and extend the
query-block/info block commands to return the I/O status information.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.h')
-rw-r--r-- | block.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -77,6 +77,16 @@ typedef enum { BDRV_ACTION_REPORT, BDRV_ACTION_IGNORE, BDRV_ACTION_STOP } BlockMonEventAction; +typedef enum { + BDRV_IOS_INVAL, BDRV_IOS_OK, BDRV_IOS_FAILED, BDRV_IOS_ENOSPC, + BDRV_IOS_MAX +} BlockIOStatus; + +void bdrv_iostatus_enable(BlockDriverState *bs); +void bdrv_iostatus_reset(BlockDriverState *bs); +void bdrv_iostatus_disable(BlockDriverState *bs); +bool bdrv_iostatus_is_enabled(const BlockDriverState *bs); +void bdrv_iostatus_set_err(BlockDriverState *bs, int error); void bdrv_mon_event(const BlockDriverState *bdrv, BlockMonEventAction action, int is_read); void bdrv_info_print(Monitor *mon, const QObject *data); |