When the device doesn't have an image, this returns:

         {
             "device": "ide1-cd0",
             "info": {
                 "virtual-size": 0,
                 "filename": "",
                 "format": ""
             }
         },

But it would be better to return an empty dict or even omit 'info'
completely. One more comment below.


  Will make info as optional, thanks.
+
+    return head;
+}
+
  BlockInfo *bdrv_query_block_info(BlockDriverState *bs)
  {
      BlockInfo *info = g_malloc0(sizeof(*info));
diff --git a/qapi-schema.json b/qapi-schema.json
index 5dfa052..565737c 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -245,6 +245,22 @@
             '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'] 
} }

  ##
+# @DeviceImageInfo:
+#
+# Information about an image used by QEMU block device
+#
+# @device: name of the block device
+#
+# @info: info of the image used.

Info is too generic, please call it 'image'.


 OK.


Reply via email to