Add in the command output object's property values right after creation
(i.e. state of the object returned by object_new() or equivalent).
Follow up patch will add machine property 'numa-mem-supported', which
would allow mgmt to introspect which machine types (versions) still
support legacy "-numa mem=FOO" CLI option and which don't and require
alternative '-numa memdev' option being used.
Signed-off-by: Igor Mammedov <imammedo(a)redhat.com>
---
qapi/misc.json | 5 ++++-
qmp.c | 5 +++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/qapi/misc.json b/qapi/misc.json
index 8b3ca4f..e333285 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -1365,10 +1365,13 @@
#
# @description: if specified, the description of the property.
#
+# @default: initial property value.
+#
# Since: 1.2
##
{ 'struct': 'ObjectPropertyInfo',
- 'data': { 'name': 'str', 'type': 'str',
'*description': 'str' } }
+ 'data': { 'name': 'str', 'type': 'str',
'*description': 'str',
+ '*default': 'any' } }
##
# @qom-list:
diff --git a/qmp.c b/qmp.c
index b92d62c..8415541 100644
--- a/qmp.c
+++ b/qmp.c
@@ -593,6 +593,11 @@ ObjectPropertyInfoList *qmp_qom_list_properties(const char
*typename,
info->type = g_strdup(prop->type);
info->has_description = !!prop->description;
info->description = g_strdup(prop->description);
+ if (obj) {
+ info->q_default =
+ object_property_get_qobject(obj, info->name, NULL);
+ info->has_q_default = !!info->q_default;
+ }
entry = g_malloc0(sizeof(*entry));
entry->value = info;
--
2.7.4