diff options
-rw-r--r-- | hw/core/qdev-properties-system.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 2ba2504ea0..e55afe6bf2 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -126,7 +126,16 @@ static void release_drive(Object *obj, const char *name, void *opaque) static char *print_drive(void *ptr) { - return g_strdup(blk_name(ptr)); + const char *name; + + name = blk_name(ptr); + if (!*name) { + BlockDriverState *bs = blk_bs(ptr); + if (bs) { + name = bdrv_get_node_name(bs); + } + } + return g_strdup(name); } static void get_drive(Object *obj, Visitor *v, const char *name, void *opaque, |