qmp: Use ObjectProperty.type if present
authorFam Zheng <famz@redhat.com>
Fri, 14 Jul 2017 02:14:53 +0000 (10:14 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 14 Jul 2017 10:04:42 +0000 (12:04 +0200)
The dynamic value is more informative in the case of link property,
otherwise it is the same.

Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170714021509.23681-5-famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qmp.c

diff --git a/qmp.c b/qmp.c
index e6b68fe7983f2d43d4fd1306df57f4d3cf2279a2..2cd40c3080e75ad0d9c945c2555185b5f05c5223 100644 (file)
--- a/qmp.c
+++ b/qmp.c
@@ -486,7 +486,8 @@ static DevicePropertyInfo *make_device_property_info(ObjectClass *klass,
 
             info = g_malloc0(sizeof(*info));
             info->name = g_strdup(prop->name);
-            info->type = g_strdup(prop->info->name);
+            info->type = default_type ? g_strdup(default_type)
+                                      : g_strdup(prop->info->name);
             info->has_description = !!prop->info->description;
             info->description = g_strdup(prop->info->description);
             return info;