All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-block@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/3] block: use bdrv_get_device_or_node_name() in error messages
Date: Wed, 08 Apr 2015 10:27:34 -0600	[thread overview]
Message-ID: <552556F6.2000104@redhat.com> (raw)
In-Reply-To: <9823a1f0514fdb0692e92868661c38a9e00a12d6.1428485266.git.berto@igalia.com>

[-- Attachment #1: Type: text/plain, Size: 2980 bytes --]

On 04/08/2015 03:29 AM, Alberto Garcia wrote:
> There are several error messages that identify a BlockDriverState by
> its device name. However those errors can be produced in nodes that
> don't have a device name associated.
> 
> In those cases we should use bdrv_get_device_or_node_name() to fall
> back to the node name and produce a more meaningful message. The
> messages are also updated to use the more generic term 'node' instead
> of 'device'.
> 
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> Reviewed-by: Max Reitz <mreitz@redhat.com>
> ---

> +++ 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
> @@ -1248,13 +1248,14 @@ static void internal_snapshot_prepare(BlkTransactionState *common,
>      }
>  
>      if (bdrv_is_read_only(bs)) {
> -        error_set(errp, QERR_DEVICE_IS_READ_ONLY, device);
> +        error_setg(errp, "Device '%s' is read only", device);
>          return;
>      }

This one is probably fine as device;

>  
>      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.

But it's already a strict improvement, so I can live with:

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2015-04-08 16:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08  9:29 [Qemu-devel] [PATCH v4 0/3] Add bdrv_get_device_or_node_name() Alberto Garcia
2015-04-08  9:29 ` [Qemu-devel] [PATCH 1/3] block: add bdrv_get_device_or_node_name() Alberto Garcia
2015-04-08 16:32   ` Eric Blake
2015-04-08  9:29 ` [Qemu-devel] [PATCH 2/3] block: use bdrv_get_device_or_node_name() in error messages Alberto Garcia
2015-04-08 16:27   ` Eric Blake [this message]
2015-04-09  8:25     ` Alberto Garcia
2015-04-08  9:29 ` [Qemu-devel] [PATCH 3/3] block: add 'node-name' field to BLOCK_IMAGE_CORRUPTED Alberto Garcia
2015-04-08 23:32   ` Eric Blake
2015-04-09  7:30     ` Alberto Garcia
2015-04-15 13:24   ` Max Reitz
2015-04-21 13:47 ` [Qemu-devel] [Qemu-block] [PATCH v4 0/3] Add bdrv_get_device_or_node_name() Stefan Hajnoczi
  -- strict thread matches above, loose matches on Subject: below --
2015-03-20 14:33 [Qemu-devel] [PATCH v3 " Alberto Garcia
2015-03-20 14:33 ` [Qemu-devel] [PATCH 2/3] block: use bdrv_get_device_or_node_name() in error messages Alberto Garcia
2015-03-20 19:24   ` Max Reitz
2015-03-20 10:19 [Qemu-devel] [PATCH v2 0/3] Add bdrv_get_device_or_node_name() Alberto Garcia
2015-03-20 10:19 ` [Qemu-devel] [PATCH 2/3] block: use bdrv_get_device_or_node_name() in error messages Alberto Garcia
2015-03-20 13:22   ` Max Reitz
2015-03-20 13:57     ` Markus Armbruster
2015-03-19 15:43 [Qemu-devel] [PATCH 0/3] Add bdrv_get_device_or_node_name() Alberto Garcia
2015-03-19 15:43 ` [Qemu-devel] [PATCH 2/3] block: use bdrv_get_device_or_node_name() in error messages Alberto Garcia
2015-03-19 19:37   ` Max Reitz
2015-03-20  7:52   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=552556F6.2000104@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berto@igalia.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.