@@ -66,7 +66,8 @@ CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
return head;
}
-MachineInfoList *qmp_query_machines(Error **errp)
+MachineInfoList *qmp_query_machines(bool has_compat_props, bool compat_props,
+ Error **errp)
{
GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
MachineInfoList *mach_list = NULL;
@@ -98,6 +99,26 @@ MachineInfoList *qmp_query_machines(Error **errp)
info->default_ram_id = g_strdup(mc->default_ram_id);
}
+ if (compat_props && mc->compat_props) {
+ int i;
+ info->compat_props = NULL;
+ CompatPropertyList **tail = &(info->compat_props);
+ info->has_compat_props = true;
+
+ for (i = 0; i < mc->compat_props->len; i++) {
+ GlobalProperty *mt_prop = g_ptr_array_index(mc->compat_props,
+ i);
+ CompatProperty *prop;
+
+ prop = g_malloc0(sizeof(*prop));
+ prop->driver = g_strdup(mt_prop->driver);
+ prop->property = g_strdup(mt_prop->property);
+ prop->value = g_strdup(mt_prop->value);
+
+ QAPI_LIST_APPEND(tail, prop);
+ }
+ }
+
QAPI_LIST_PREPEND(mach_list, info);
}
@@ -135,6 +135,29 @@
##
{ 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] }
+##
+# @CompatProperty:
+#
+# Machine type compatibility property that uses in machine
+# definitions to specify default values. It's based on representaion
+# of properties in QEMU and created for machine type comparing
+# (see scripts/compare-machine-types.py)
+#
+# @driver: name of the driver which default value of certain property
+# is changed in the machine type
+#
+# @property: property name
+#
+# @value: property value that will be assigned as default to
+# the driver by machine type
+#
+# Since: 9.0
+##
+{ 'struct': 'CompatProperty',
+ 'data': { 'driver': 'str',
+ 'property': 'str',
+ 'value': 'str' } }
+
##
# @MachineInfo:
#
@@ -166,6 +189,13 @@
#
# @acpi: machine type supports ACPI (since 8.0)
#
+# @compat-props: List of the machine type's compatibility properties.
+# (since 9.0)
+#
+# Features:
+#
+# @unstable: Member @compat-props is experimental.
+#
# Since: 1.2
##
{ 'struct': 'MachineInfo',
@@ -173,18 +203,48 @@
'*is-default': 'bool', 'cpu-max': 'int',
'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool',
'deprecated': 'bool', '*default-cpu-type': 'str',
- '*default-ram-id': 'str', 'acpi': 'bool' } }
+ '*default-ram-id': 'str', 'acpi': 'bool',
+ '*compat-props': { 'type': ['CompatProperty'],
+ 'features': ['unstable'] } } }
##
# @query-machines:
#
# Return a list of supported machines
#
+# @compat-props: if true return will contain information about
+# machine type compatibility properties (since 9.0)
+#
# Returns: a list of MachineInfo
#
# Since: 1.2
+#
+# Example:
+#
+# -> { "execute": "query-machines", "arguments": { "compat-props": true } }
+# <- { "return": [
+# {
+# "hotpluggable-cpus": true,
+# "name": "pc-q35-6.2",
+# "compat-props": [
+# {
+# "driver": "virtio-mem",
+# "property": "unplugged-inaccessible",
+# "value": "off"
+# }
+# ],
+# "numa-mem-supported": false,
+# "default-cpu-type": "qemu64-x86_64-cpu",
+# "cpu-max": 288,
+# "deprecated": false,
+# "default-ram-id": "pc.ram"
+# },
+# ...
+# }
##
-{ 'command': 'query-machines', 'returns': ['MachineInfo'] }
+{ 'command': 'query-machines',
+ 'data': { '*compat-props': 'bool' },
+ 'returns': ['MachineInfo'] }
##
# @CurrentMachineParams:
@@ -46,7 +46,7 @@ static void qos_set_machines_devices_available(void)
MachineInfoList *mach_info;
ObjectTypeInfoList *type_info;
- mach_info = qmp_query_machines(&error_abort);
+ mach_info = qmp_query_machines(false, false, &error_abort);
machines_apply_to_node(mach_info);
qapi_free_MachineInfoList(mach_info);