All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, mreitz@redhat.com, eblake@redhat.com,
	qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v3 10/12] block: Avoid printing NULL string in error messages
Date: Wed, 21 Sep 2016 14:56:09 +0200	[thread overview]
Message-ID: <1474462571-10596-11-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1474462571-10596-1-git-send-email-kwolf@redhat.com>

Even for nodes that have a BlockBackend attached, bdrv_get_parent_name()
can return NULL if the BB is anonymous (e.g. it belongs to a block job
or a device that was created with a drive=<node-name> option).

Remove the information from the error message. The user probably knows
already why the node is still in use.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 blockdev.c                 | 9 +++------
 tests/qemu-iotests/085.out | 6 +++---
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index 405145a..17c2671 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1803,8 +1803,7 @@ static void external_snapshot_prepare(BlkActionState *common,
     }
 
     if (bdrv_has_blk(state->new_bs)) {
-        error_setg(errp, "The snapshot is already in use by %s",
-                   bdrv_get_parent_name(state->new_bs));
+        error_setg(errp, "The snapshot is already in use");
         return;
     }
 
@@ -2532,8 +2531,7 @@ void qmp_x_blockdev_insert_medium(bool has_device, const char *device,
     }
 
     if (bdrv_has_blk(bs)) {
-        error_setg(errp, "Node '%s' is already in use by '%s'", node_name,
-                   bdrv_get_parent_name(bs));
+        error_setg(errp, "Node '%s' is already in use", node_name);
         return;
     }
 
@@ -3941,8 +3939,7 @@ void qmp_x_blockdev_del(bool has_id, const char *id,
             return;
         }
         if (bdrv_has_blk(bs)) {
-            error_setg(errp, "Node %s is in use by %s",
-                       node_name, bdrv_get_parent_name(bs));
+            error_setg(errp, "Node %s is in use", node_name);
             return;
         }
         aio_context = bdrv_get_aio_context(bs);
diff --git a/tests/qemu-iotests/085.out b/tests/qemu-iotests/085.out
index 01c78d6..08e4bb7 100644
--- a/tests/qemu-iotests/085.out
+++ b/tests/qemu-iotests/085.out
@@ -68,9 +68,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/
 
 === Invalid command - snapshot node used as active layer ===
 
-{"error": {"class": "GenericError", "desc": "The snapshot is already in use by virtio0"}}
-{"error": {"class": "GenericError", "desc": "The snapshot is already in use by virtio0"}}
-{"error": {"class": "GenericError", "desc": "The snapshot is already in use by virtio1"}}
+{"error": {"class": "GenericError", "desc": "The snapshot is already in use"}}
+{"error": {"class": "GenericError", "desc": "The snapshot is already in use"}}
+{"error": {"class": "GenericError", "desc": "The snapshot is already in use"}}
 
 === Invalid command - snapshot node used as backing hd ===
 
-- 
1.8.3.1

  parent reply	other threads:[~2016-09-21 12:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21 12:55 [Qemu-devel] [PATCH v3 00/12] block: Remove BB interface from blockdev-add/del Kevin Wolf
2016-09-21 12:56 ` [Qemu-devel] [PATCH v3 01/12] qemu-iotests/041: Avoid blockdev-add with id Kevin Wolf
2016-09-21 12:56 ` [Qemu-devel] [PATCH v3 02/12] qemu-iotests/067: " Kevin Wolf
2016-09-21 12:56 ` [Qemu-devel] [PATCH v3 03/12] qemu-iotests/071: " Kevin Wolf
2016-09-21 12:56 ` [Qemu-devel] [PATCH v3 04/12] qemu-iotests/081: " Kevin Wolf
2016-09-21 12:56 ` [Qemu-devel] [PATCH v3 05/12] qemu-iotests/087: " Kevin Wolf
2016-09-21 12:56 ` [Qemu-devel] [PATCH v3 06/12] qemu-iotests/117: " Kevin Wolf
2016-09-21 12:56 ` [Qemu-devel] [PATCH v3 07/12] qemu-iotests/118: " Kevin Wolf
2016-09-21 12:56 ` [Qemu-devel] [PATCH v3 08/12] qemu-iotests/124: " Kevin Wolf
2016-09-21 12:56 ` [Qemu-devel] [PATCH v3 09/12] qemu-iotests/139: " Kevin Wolf
2016-09-21 12:56 ` Kevin Wolf [this message]
2016-09-21 14:16   ` [Qemu-devel] [PATCH v3 10/12] block: Avoid printing NULL string in error messages Eric Blake
2016-09-21 12:56 ` [Qemu-devel] [PATCH v3 11/12] qemu-iotests/141: Avoid blockdev-add with id Kevin Wolf
2016-09-21 14:17   ` Eric Blake
2016-09-21 12:56 ` [Qemu-devel] [PATCH v3 12/12] block: Remove BB interface from blockdev-add/del Kevin Wolf
2016-09-21 14:20   ` Eric Blake
2016-09-21 14:48 ` [Qemu-devel] [PATCH v3 00/12] " Kevin Wolf

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=1474462571-10596-11-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=eblake@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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.