diff mbox

[8/9] block: bdrv_reopen_prepare(): don't use QERR_OPEN_FILE_FAILED

Message ID 1370883748-31439-9-git-send-email-lcapitulino@redhat.com
State New
Headers show

Commit Message

Luiz Capitulino June 10, 2013, 5:02 p.m. UTC
The call to drv->bdrv_reopen_prepare() can fail due to reasons
other than an open failure. Unfortunately, we can't use errno
nor -ret, cause they are not always set.

Stick to a generic error message then.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 block.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kevin Wolf June 11, 2013, 8:38 a.m. UTC | #1
Am 10.06.2013 um 19:02 hat Luiz Capitulino geschrieben:
> The call to drv->bdrv_reopen_prepare() can fail due to reasons
> other than an open failure. Unfortunately, we can't use errno
> nor -ret, cause they are not always set.
> 
> Stick to a generic error message then.
> 
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  block.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/block.c b/block.c
> index 79ad33d..b88ad2f 100644
> --- a/block.c
> +++ b/block.c
> @@ -1291,8 +1291,8 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue,
>              if (local_err != NULL) {
>                  error_propagate(errp, local_err);
>              } else {
> -                error_set(errp, QERR_OPEN_FILE_FAILED,
> -                          reopen_state->bs->filename);
> +                error_setg(errp, "failed while preparing to reopen image '%s'",

Please start the message with an uppercase letter like before.

Also, maybe "Failed to prepare for reopening '%s'" is better?

> +                           reopen_state->bs->filename);
>              }
>              goto error;
>          }

Kevin
Luiz Capitulino June 11, 2013, 12:32 p.m. UTC | #2
On Tue, 11 Jun 2013 10:38:47 +0200
Kevin Wolf <kwolf@redhat.com> wrote:

> Am 10.06.2013 um 19:02 hat Luiz Capitulino geschrieben:
> > The call to drv->bdrv_reopen_prepare() can fail due to reasons
> > other than an open failure. Unfortunately, we can't use errno
> > nor -ret, cause they are not always set.
> > 
> > Stick to a generic error message then.
> > 
> > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> > ---
> >  block.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/block.c b/block.c
> > index 79ad33d..b88ad2f 100644
> > --- a/block.c
> > +++ b/block.c
> > @@ -1291,8 +1291,8 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue,
> >              if (local_err != NULL) {
> >                  error_propagate(errp, local_err);
> >              } else {
> > -                error_set(errp, QERR_OPEN_FILE_FAILED,
> > -                          reopen_state->bs->filename);
> > +                error_setg(errp, "failed while preparing to reopen image '%s'",
> 
> Please start the message with an uppercase letter like before.

Fixed.

> Also, maybe "Failed to prepare for reopening '%s'" is better?

I have no idea :)
diff mbox

Patch

diff --git a/block.c b/block.c
index 79ad33d..b88ad2f 100644
--- a/block.c
+++ b/block.c
@@ -1291,8 +1291,8 @@  int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue,
             if (local_err != NULL) {
                 error_propagate(errp, local_err);
             } else {
-                error_set(errp, QERR_OPEN_FILE_FAILED,
-                          reopen_state->bs->filename);
+                error_setg(errp, "failed while preparing to reopen image '%s'",
+                           reopen_state->bs->filename);
             }
             goto error;
         }