]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qapi/qmp: add ObjectPropertyInfo.default-value
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Fri, 10 Jan 2020 15:30:38 +0000 (19:30 +0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 24 Jan 2020 19:59:16 +0000 (20:59 +0100)
Report the default value associated with a property.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20200110153039.1379601-26-marcandre.lureau@redhat.com>
[Report it as type "any", not string. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qapi/qom.json
qom/qom-qmp-cmds.c

index 32db96ffc4263fbe4092e15cd713a566bfb7b1fe..1e3c2ad5556d1d5d1252f9a53f4da9067377959d 100644 (file)
 #
 # @description: if specified, the description of the property.
 #
+# @default-value: the default value, if any (since 5.0)
+#
 # Since: 1.2
 ##
 { 'struct': 'ObjectPropertyInfo',
-  'data': { 'name': 'str', 'type': 'str', '*description': 'str' } }
+  'data': { 'name': 'str',
+            'type': 'str',
+            '*description': 'str',
+            '*default-value': 'any' } }
 
 ##
 # @qom-list:
index 8785816c1f72c097f33345495fa0f28f4d8a9027..6136efec16f85381c1cbc001ac84f2f2ba3c11bf 100644 (file)
@@ -177,6 +177,8 @@ ObjectPropertyInfoList *qmp_device_list_properties(const char *typename,
         info->type = g_strdup(prop->type);
         info->has_description = !!prop->description;
         info->description = g_strdup(prop->description);
+        info->default_value = qobject_ref(prop->defval);
+        info->has_default_value = !!info->default_value;
 
         entry = g_malloc0(sizeof(*entry));
         entry->value = info;