]>
Commit | Line | Data |
---|---|---|
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | |
2 | From: Dietmar Maurer <dietmar@proxmox.com> | |
3 | Date: Mon, 6 Apr 2020 12:16:44 +0200 | |
4 | Subject: [PATCH] PVE: qapi: modify query machines | |
5 | ||
6 | provide '*is-current' in MachineInfo struct | |
7 | ||
8 | Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> | |
9 | Signed-off-by: Dietmar Maurer <dietmar@proxmox.com> | |
10 | --- | |
11 | hw/core/machine-qmp-cmds.c | 6 ++++++ | |
12 | qapi/machine.json | 4 +++- | |
13 | 2 files changed, 9 insertions(+), 1 deletion(-) | |
14 | ||
15 | diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c | |
16 | index 4b72009cd3..314351cdff 100644 | |
17 | --- a/hw/core/machine-qmp-cmds.c | |
18 | +++ b/hw/core/machine-qmp-cmds.c | |
19 | @@ -90,6 +90,12 @@ MachineInfoList *qmp_query_machines(Error **errp) | |
20 | info->numa_mem_supported = mc->numa_mem_supported; | |
21 | info->deprecated = !!mc->deprecation_reason; | |
22 | info->acpi = !!object_class_property_find(OBJECT_CLASS(mc), "acpi"); | |
23 | + | |
24 | + if (strcmp(mc->name, MACHINE_GET_CLASS(current_machine)->name) == 0) { | |
25 | + info->has_is_current = true; | |
26 | + info->is_current = true; | |
27 | + } | |
28 | + | |
29 | if (mc->default_cpu_type) { | |
30 | info->default_cpu_type = g_strdup(mc->default_cpu_type); | |
31 | } | |
32 | diff --git a/qapi/machine.json b/qapi/machine.json | |
33 | index 2054cdc70d..a024d5b05d 100644 | |
34 | --- a/qapi/machine.json | |
35 | +++ b/qapi/machine.json | |
36 | @@ -146,6 +146,8 @@ | |
37 | # | |
38 | # @is-default: whether the machine is default | |
39 | # | |
40 | +# @is-current: whether this machine is currently used | |
41 | +# | |
42 | # @cpu-max: maximum number of CPUs supported by the machine type | |
43 | # (since 1.5) | |
44 | # | |
45 | @@ -170,7 +172,7 @@ | |
46 | ## | |
47 | { 'struct': 'MachineInfo', | |
48 | 'data': { 'name': 'str', '*alias': 'str', | |
49 | - '*is-default': 'bool', 'cpu-max': 'int', | |
50 | + '*is-default': 'bool', '*is-current': 'bool', 'cpu-max': 'int', | |
51 | 'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool', | |
52 | 'deprecated': 'bool', '*default-cpu-type': 'str', | |
53 | '*default-ram-id': 'str', 'acpi': 'bool' } } |