From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yg7ly-0005rY-Up for qemu-devel@nongnu.org; Thu, 09 Apr 2015 04:25:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yg7lv-000884-Km for qemu-devel@nongnu.org; Thu, 09 Apr 2015 04:25:14 -0400 Date: Thu, 9 Apr 2015 10:25:07 +0200 From: Alberto Garcia Message-ID: <20150409082507.GA8492@igalia.com> References: <9823a1f0514fdb0692e92868661c38a9e00a12d6.1428485266.git.berto@igalia.com> <552556F6.2000104@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <552556F6.2000104@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/3] block: use bdrv_get_device_or_node_name() in error messages List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Kevin Wolf , qemu-block@nongnu.org, Markus Armbruster , qemu-devel@nongnu.org, Max Reitz , Stefan Hajnoczi 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