This will make the default werror (=enospc) work better when qcow2 is created on top of iscsi or other block devices.
Signed-off-by: Fam Zheng <f...@redhat.com> --- block/qcow2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index bacc4f2..8edf0fe 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1586,6 +1586,12 @@ static coroutine_fn int qcow2_co_writev(BlockDriverState *bs, cur_nr_sectors, &hd_qiov); qemu_co_mutex_lock(&s->lock); if (ret < 0) { + if (ret == -ERANGE) { + /* Out of range access means we're already allocating clusters + * beyond end of disk, fix the error code to support + * werror=enospc. */ + ret = -ENOSPC; + } goto fail; } -- 2.4.3