qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH 2/3] block: use bdrv_get_device_or_node_name() i


From: Alberto Garcia
Subject: Re: [Qemu-block] [PATCH 2/3] block: use bdrv_get_device_or_node_name() in error messages
Date: Thu, 9 Apr 2015 10:25:07 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Wed, Apr 08, 2015 at 10:27:34AM -0600, Eric Blake wrote:

> > +++ b/block/snapshot.c
> > @@ -246,9 +246,9 @@ int bdrv_snapshot_delete(BlockDriverState *bs,
> >      if (bs->file) {
> >          return bdrv_snapshot_delete(bs->file, snapshot_id, name, errp);
> >      }
> > -    error_set(errp, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
> > -              drv->format_name, bdrv_get_device_name(bs),
> > -              "internal snapshot deletion");
> > +    error_setg(errp, "Block format '%s' used by device '%s' "
> > +               "does not support internal snapshot deletion",
> > +               drv->format_name, bdrv_get_device_name(bs));
> >      return -ENOTSUP;
> >  }
> >  
> > @@ -329,9 +329,9 @@ int bdrv_snapshot_load_tmp(BlockDriverState *bs,
> >      if (drv->bdrv_snapshot_load_tmp) {
> >          return drv->bdrv_snapshot_load_tmp(bs, snapshot_id, name, errp);
> >      }
> > -    error_set(errp, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
> > -              drv->format_name, bdrv_get_device_name(bs),
> > -              "temporarily load internal snapshot");
> > +    error_setg(errp, "Block format '%s' used by device '%s' "
> > +               "does not support temporarily loading internal snapshots",
> > +               drv->format_name, bdrv_get_device_name(bs));
> 
> Should these two messages use 'node' instead of 'device'?  After
> all, a format is tied to a node (as a backing chain can involve
> multiple nodes using different formats)
> 
> > +++ b/blockdev.c
> >      if (!bdrv_can_snapshot(bs)) {
> > -        error_set(errp, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
> > -                  bs->drv->format_name, device, "internal snapshot");
> > +        error_setg(errp, "Block format '%s' used by device '%s' "
> > +                   "does not support internal snapshots",
> > +                   bs->drv->format_name, device);
> 
> but this is probably another one where node may be better.

I decided to leave 'device' in all cases where 'bs' cannot possibly be
anything else that a root node.

In this latter case, for example, that bs is obtained using
blk_bs(blk_by_name(device)).

Berto



reply via email to

[Prev in Thread] Current Thread [Next in Thread]