qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] block/quorum: make quorum_getlength error message user friendly
@ 2014-07-11  7:34 Liu Yuan
  2014-07-11 10:26 ` Kevin Wolf
  0 siblings, 1 reply; 3+ messages in thread
From: Liu Yuan @ 2014-07-11  7:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Benoit Canet, Stefan Hajnoczi

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 <benoit@irqsave.net>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
---
 block/quorum.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/quorum.c b/block/quorum.c
index 2f18755..51437ad 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -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;
         }
     }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] block/quorum: make quorum_getlength error message user friendly
  2014-07-11  7:34 [Qemu-devel] [PATCH] block/quorum: make quorum_getlength error message user friendly Liu Yuan
@ 2014-07-11 10:26 ` Kevin Wolf
  2014-07-12  3:42   ` Liu Yuan
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Wolf @ 2014-07-11 10:26 UTC (permalink / raw)
  To: Liu Yuan; +Cc: qemu-devel, Stefan Hajnoczi, Benoit Canet

Am 11.07.2014 um 09:34 hat Liu Yuan geschrieben:
> 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 <benoit@irqsave.net>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Liu Yuan <namei.unix@gmail.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] block/quorum: make quorum_getlength error message user friendly
  2014-07-11 10:26 ` Kevin Wolf
@ 2014-07-12  3:42   ` Liu Yuan
  0 siblings, 0 replies; 3+ messages in thread
From: Liu Yuan @ 2014-07-12  3:42 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel, Stefan Hajnoczi, Benoit Canet

On Fri, Jul 11, 2014 at 12:26:58PM +0200, Kevin Wolf wrote:
> Am 11.07.2014 um 09:34 hat Liu Yuan geschrieben:
> > 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 <benoit@irqsave.net>
> > Cc: Kevin Wolf <kwolf@redhat.com>
> > Cc: Stefan Hajnoczi <stefanha@redhat.com>
> > Signed-off-by: Liu Yuan <namei.unix@gmail.com>
> 
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-12  3:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-11  7:34 [Qemu-devel] [PATCH] block/quorum: make quorum_getlength error message user friendly Liu Yuan
2014-07-11 10:26 ` Kevin Wolf
2014-07-12  3:42   ` Liu Yuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).