We have several cases of error messages related to BlockDriverState that expect it to have a device name.
However many of those can happen in nodes that don't have a device name associated so the generated error messages are not very meaningful. This series adds a new function bdrv_get_device_or_node_name(), that returns the node name if there is no device name for that node. Since both the device and the node name live in the same namespace, there's no ambiguity. And since it gives preference to the device name, it maintains backward compatibility. It also updates all calls to bdrv_get_device_name() where it makes sense: several error messages and the BLOCK_IMAGE_CORRUPTED event. I wrote this thinking on the case where any arbitrary node will be able to own a block job, but I think it's useful already for the reasons explained above. Berto Alberto Garcia (3): block: add bdrv_get_device_or_node_name() block: use bdrv_get_device_or_node_name() in error messages block: allow BLOCK_IMAGE_CORRUPTED to have a node name block.c | 18 ++++++++++++------ block/qcow.c | 4 ++-- block/qcow2.c | 7 ++++--- block/qed.c | 2 +- block/quorum.c | 5 +---- block/vdi.c | 2 +- block/vhdx.c | 2 +- block/vmdk.c | 4 ++-- block/vpc.c | 2 +- block/vvfat.c | 3 ++- docs/qmp/qmp-events.txt | 2 +- include/block/block.h | 1 + qapi/block-core.json | 2 +- 13 files changed, 30 insertions(+), 24 deletions(-) -- 2.1.4