mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
block-backend: improve blk_root_get_parent_desc()
We have different types of parents: block nodes, block backends and jobs. So, it makes sense to specify type together with name. While being here also use g_autofree. iotest 307 output is updated. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-Id: <20210601075218.79249-3-vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
f8d2ad7881
commit
fd240a184b
2 changed files with 5 additions and 6 deletions
|
@ -141,19 +141,18 @@ static void blk_root_set_aio_ctx(BdrvChild *child, AioContext *ctx,
|
||||||
static char *blk_root_get_parent_desc(BdrvChild *child)
|
static char *blk_root_get_parent_desc(BdrvChild *child)
|
||||||
{
|
{
|
||||||
BlockBackend *blk = child->opaque;
|
BlockBackend *blk = child->opaque;
|
||||||
char *dev_id;
|
g_autofree char *dev_id = NULL;
|
||||||
|
|
||||||
if (blk->name) {
|
if (blk->name) {
|
||||||
return g_strdup(blk->name);
|
return g_strdup_printf("block device '%s'", blk->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_id = blk_get_attached_dev_id(blk);
|
dev_id = blk_get_attached_dev_id(blk);
|
||||||
if (*dev_id) {
|
if (*dev_id) {
|
||||||
return dev_id;
|
return g_strdup_printf("block device '%s'", dev_id);
|
||||||
} else {
|
} else {
|
||||||
/* TODO Callback into the BB owner for something more detailed */
|
/* TODO Callback into the BB owner for something more detailed */
|
||||||
g_free(dev_id);
|
return g_strdup("an unnamed block device");
|
||||||
return g_strdup("a block device");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ exports available: 1
|
||||||
|
|
||||||
=== Add a writable export ===
|
=== Add a writable export ===
|
||||||
{"execute": "block-export-add", "arguments": {"description": "This is the writable second export", "id": "export1", "name": "export1", "node-name": "fmt", "type": "nbd", "writable": true, "writethrough": true}}
|
{"execute": "block-export-add", "arguments": {"description": "This is the writable second export", "id": "export1", "name": "export1", "node-name": "fmt", "type": "nbd", "writable": true, "writethrough": true}}
|
||||||
{"error": {"class": "GenericError", "desc": "Conflicts with use by sda as 'root', which does not allow 'write' on fmt"}}
|
{"error": {"class": "GenericError", "desc": "Conflicts with use by block device 'sda' as 'root', which does not allow 'write' on fmt"}}
|
||||||
{"execute": "device_del", "arguments": {"id": "sda"}}
|
{"execute": "device_del", "arguments": {"id": "sda"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
{"data": {"device": "sda", "path": "/machine/peripheral/sda"}, "event": "DEVICE_DELETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
{"data": {"device": "sda", "path": "/machine/peripheral/sda"}, "event": "DEVICE_DELETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue