summary refs log tree commit diff stats
path: root/hw/block/block.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/block/block.c')
-rw-r--r--hw/block/block.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/hw/block/block.c b/hw/block/block.c
index cf0eb826f1..b6c80ab0b7 100644
--- a/hw/block/block.c
+++ b/hw/block/block.c
@@ -15,6 +15,19 @@
 #include "qapi/qapi-types-block.h"
 #include "qemu/error-report.h"
 
+void blkconf_serial(BlockConf *conf, char **serial)
+{
+    DriveInfo *dinfo;
+
+    if (!*serial) {
+        /* try to fall back to value set with legacy -drive serial=... */
+        dinfo = blk_legacy_dinfo(conf->blk);
+        if (dinfo) {
+            *serial = g_strdup(dinfo->serial);
+        }
+    }
+}
+
 void blkconf_blocksizes(BlockConf *conf)
 {
     BlockBackend *blk = conf->blk;