From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, mreitz@redhat.com, kwolf@redhat.com,
vsementsov@virtuozzo.com, Alberto Garcia <berto@igalia.com>
Subject: [PATCH v3 3/6] block: improve bdrv_child_get_parent_desc()
Date: Tue, 1 Jun 2021 10:52:15 +0300 [thread overview]
Message-ID: <20210601075218.79249-4-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20210601075218.79249-1-vsementsov@virtuozzo.com>
We have different types of parents: block nodes, block backends and
jobs. So, it makes sense to specify type together with name.
Next, this handler us used to compose an error message about permission
conflict. And permission conflict occurs in a specific place of block
graph. We shouldn't report name of parent device (as it refers another
place in block graph), but exactly and only the name of the node. So,
use bdrv_get_node_name() directly.
iotest 283 output is updated.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
---
block.c | 2 +-
tests/qemu-iotests/283.out | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/block.c b/block.c
index c0fd363605..94cb7b6637 100644
--- a/block.c
+++ b/block.c
@@ -1149,7 +1149,7 @@ int bdrv_parse_cache_mode(const char *mode, int *flags, bool *writethrough)
static char *bdrv_child_get_parent_desc(BdrvChild *c)
{
BlockDriverState *parent = c->opaque;
- return g_strdup(bdrv_get_device_or_node_name(parent));
+ return g_strdup_printf("node '%s'", bdrv_get_node_name(parent));
}
static void bdrv_child_cb_drained_begin(BdrvChild *child)
diff --git a/tests/qemu-iotests/283.out b/tests/qemu-iotests/283.out
index 97e62a4c94..c9397bfc44 100644
--- a/tests/qemu-iotests/283.out
+++ b/tests/qemu-iotests/283.out
@@ -5,7 +5,7 @@
{"execute": "blockdev-add", "arguments": {"driver": "blkdebug", "image": "base", "node-name": "other", "take-child-perms": ["write"]}}
{"return": {}}
{"execute": "blockdev-backup", "arguments": {"device": "source", "sync": "full", "target": "target"}}
-{"error": {"class": "GenericError", "desc": "Cannot append backup-top filter: Conflicts with use by source as 'image', which does not allow 'write' on base"}}
+{"error": {"class": "GenericError", "desc": "Cannot append backup-top filter: Conflicts with use by node 'source' as 'image', which does not allow 'write' on base"}}
=== backup-top should be gone after job-finalize ===
--
2.29.2
next prev parent reply other threads:[~2021-06-01 7:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-01 7:52 [PATCH v3 0/6] block permission updated follow-up Vladimir Sementsov-Ogievskiy
2021-06-01 7:52 ` [PATCH v3 1/6] block: document child argument of bdrv_attach_child_common() Vladimir Sementsov-Ogievskiy
2021-06-01 7:52 ` [PATCH v3 2/6] block-backend: improve blk_root_get_parent_desc() Vladimir Sementsov-Ogievskiy
2021-06-01 7:52 ` Vladimir Sementsov-Ogievskiy [this message]
2021-06-01 7:52 ` [PATCH v3 4/6] block/vvfat: inherit child_vvfat_qcow from child_of_bds Vladimir Sementsov-Ogievskiy
2021-06-01 7:52 ` [PATCH v3 5/6] block: simplify bdrv_child_user_desc() Vladimir Sementsov-Ogievskiy
2021-06-01 7:52 ` [PATCH v3 6/6] block: improve permission conflict error message Vladimir Sementsov-Ogievskiy
2021-06-01 15:08 ` [PATCH v3 0/6] block permission updated follow-up 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=20210601075218.79249-4-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=berto@igalia.com \
--cc=kwolf@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).