diff options
author | MORITA Kazutaka <morita.kazutaka@gmail.com> | 2012-05-03 05:26:07 +0900 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-05-07 19:33:18 +0200 |
commit | 115c2b5a6806615206dfa5518509911bfc7b1d07 (patch) | |
tree | e79ec54d0bb3ef66e9da3708846d653291013cba /block/sheepdog.c | |
parent | 847c25d01cbe8e4fe457a7426f82daaaf3287aae (diff) | |
download | hqemu-115c2b5a6806615206dfa5518509911bfc7b1d07.zip hqemu-115c2b5a6806615206dfa5518509911bfc7b1d07.tar.gz |
sheepdog: switch to writethrough mode if cluster doesn't support flush
This is necessary for qemu to work with the older version of Sheepdog
which doesn't support SD_OP_FLUSH_VDI.
Signed-off-by: MORITA Kazutaka <morita.kazutaka@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/sheepdog.c')
-rw-r--r-- | block/sheepdog.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/block/sheepdog.c b/block/sheepdog.c index 0ed6b19..e01d371 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -1678,6 +1678,14 @@ static int coroutine_fn sd_co_flush_to_disk(BlockDriverState *bs) return ret; } + if (rsp->result == SD_RES_INVALID_PARMS) { + dprintf("disable write cache since the server doesn't support it\n"); + + s->cache_enabled = 0; + closesocket(s->flush_fd); + return 0; + } + if (rsp->result != SD_RES_SUCCESS) { error_report("%s", sd_strerror(rsp->result)); return -EIO; |