Skip to contentSkip to conversation

block/quorum: make quorum_getlength error message user friendly

PATCH In review Liu Yuan 2 participants 3 messages Jul 11, 2014 – Jul 12, 2014 Block layer

lore
Share & tools
lore

Liu Yuan

author
#0 lore raw

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

Cc Benoit Canet <[email protected]>
Cc Kevin Wolf <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
---
 block/quorum.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
block/quorum.c +2 -1
index 2f18755..51437ad 100644
@@ -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
#1 lore raw

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 error

EIO 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 argument

Cc Benoit Canet <[email protected]>
Cc Kevin Wolf <[email protected]>
Cc Stefan Hajnoczi <[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

author
#2 lore raw
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 error

EIO 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 argument

Cc Benoit Canet <[email protected]>
Cc Kevin Wolf <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Quoted 6 lines

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

Make sense. I'll do it after we settle down my 'add simple read pattern' patch since they are conflicted.

Yuan