block/quorum: make quorum_getlength error message user friendly
PATCH 1/1 block/quorum: make quorum_getlength error message user friendly
When start quorum driver with 2 different sized images, we get:
qemu-system-x86_64: -drive if=virtio,driver=quorum...: Could not refresh total \
sector count: Input/output error
EIO would confuse users. With this patch, the error message goes like
Children images are not in the same size
qemu-system-x86_64: -drive if=virtio,driver=quorum...: Could not refresh total \
sector count: Invalid argument
--- block/quorum.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/quorum.c +2 -1
@@ -736,7 +736,8 @@ static int64_t quorum_getlength(BlockDriverState *bs)return value; }if (value != result) { -return -EIO ; +error_printf ("Children images are not in the same size\n" ); +return -EINVAL ; } }
Signature · 1 line
1.9.1
Am 11.07.2014 um 09:34 hat Liu Yuan geschrieben:
Quoted 7 lines
When start quorum driver with 2 different sized images, we get:
qemu-system-x86_64: -drive if=virtio,driver=quorum...: Could not refresh total \
sector count: Input/output errorEIO would confuse users. With this patch, the error message goes like
Quoted 8 lines
Children images are not in the same size
qemu-system-x86_64: -drive if=virtio,driver=quorum...: Could not refresh total \
sector count: Invalid argumentCc Benoit Canet <[email protected]>Cc Kevin Wolf <[email protected]>Cc Stefan Hajnoczi <[email protected]>Signed-off-by Liu Yuan <[email protected]>
I think it would be better to do this check in quorum_open() instead of relying on bdrv_open() to perform a bdrv_getlength(). As a bonus, quorum_open() has an Error argument, so we wouldn't have to use something like error_printf(), which doesn't work well for QMP commands.
Kevin
Quoted 17 lines · Kevin Wolf
Am 11.07.2014 um 09:34 hat Liu Yuan geschrieben:
Quoted 7 lines
When start quorum driver with 2 different sized images, we get:
qemu-system-x86_64: -drive if=virtio,driver=quorum...: Could not refresh total \
sector count: Input/output errorEIO would confuse users. With this patch, the error message goes like
Quoted 8 lines
Children images are not in the same size
qemu-system-x86_64: -drive if=virtio,driver=quorum...: Could not refresh total \
sector count: Invalid argumentCc Benoit Canet <[email protected]>Cc Kevin Wolf <[email protected]>Cc Stefan Hajnoczi <[email protected]>Signed-off-by Liu Yuan <[email protected]>
Quoted 6 lines
I think it would be better to do this check in
quorum_open()instead of relying onbdrv_open()to perform abdrv_getlength(). As a bonus,quorum_open()has an Error argument, so we wouldn't have to use something likeerror_printf(), which doesn't work well for QMP commands.Kevin
Make sense. I'll do it after we settle down my 'add simple read pattern' patch since they are conflicted.
Yuan