aboutsummaryrefslogtreecommitdiff
path: root/hw/block
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-06-29 17:41:35 +0200
committerKevin Wolf <kwolf@redhat.com>2016-07-13 13:32:27 +0200
commit8c39825218227c0d63709708602d34c4355bad56 (patch)
tree34dd245add610f9df29d03a4482b0b8cd42d079e /hw/block
parent1e8fb7f1ee1ba902ab06cb8d54eca006c3b45f42 (diff)
downloadqemu-8c39825218227c0d63709708602d34c4355bad56.zip
qemu-8c39825218227c0d63709708602d34c4355bad56.tar.gz
qemu-8c39825218227c0d63709708602d34c4355bad56.tar.bz2
block/qdev: Allow configuring rerror/werror with qdev properties
The rerror/werror policies are implemented in the devices, so that's where they should be configured. In comparison to the old options in -drive, the qdev properties are only added to those devices that actually support them. If the option isn't given (or "auto" is specified), the setting of the BlockBackend is used for compatibility with the old options. For block jobs, "auto" is the same as "enospc". Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'hw/block')
-rw-r--r--hw/block/block.c12
-rw-r--r--hw/block/virtio-blk.c1
2 files changed, 13 insertions, 0 deletions
diff --git a/hw/block/block.c b/hw/block/block.c
index 396b0d5..8dc9d84 100644
--- a/hw/block/block.c
+++ b/hw/block/block.c
@@ -54,6 +54,7 @@ void blkconf_blocksizes(BlockConf *conf)
void blkconf_apply_backend_options(BlockConf *conf)
{
BlockBackend *blk = conf->blk;
+ BlockdevOnError rerror, werror;
bool wce;
switch (conf->wce) {
@@ -64,7 +65,18 @@ void blkconf_apply_backend_options(BlockConf *conf)
abort();
}
+ rerror = conf->rerror;
+ if (rerror == BLOCKDEV_ON_ERROR_AUTO) {
+ rerror = blk_get_on_error(blk, true);
+ }
+
+ werror = conf->werror;
+ if (werror == BLOCKDEV_ON_ERROR_AUTO) {
+ werror = blk_get_on_error(blk, false);
+ }
+
blk_set_enable_write_cache(blk, wce);
+ blk_set_on_error(blk, rerror, werror);
}
void blkconf_geometry(BlockConf *conf, int *ptrans,
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index ecd8ea3..357ff90 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -960,6 +960,7 @@ static void virtio_blk_instance_init(Object *obj)
static Property virtio_blk_properties[] = {
DEFINE_BLOCK_PROPERTIES(VirtIOBlock, conf.conf),
+ DEFINE_BLOCK_ERROR_PROPERTIES(VirtIOBlock, conf.conf),
DEFINE_BLOCK_CHS_PROPERTIES(VirtIOBlock, conf.conf),
DEFINE_PROP_STRING("serial", VirtIOBlock, conf.serial),
DEFINE_PROP_BIT("config-wce", VirtIOBlock, conf.config_wce, 0, true),