]>
Commit | Line | Data |
---|---|---|
23102ed6 | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
95259824 WB |
2 | From: Wolfgang Bumiller <w.bumiller@proxmox.com> |
3 | Date: Wed, 9 Dec 2015 14:31:18 +0100 | |
53e83913 | 4 | Subject: [PATCH] PVE: qapi: modify query machines |
95259824 WB |
5 | |
6 | provide '*is-current' in MachineInfo struct | |
b855dce7 TL |
7 | |
8 | Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> | |
95259824 | 9 | --- |
53e83913 WB |
10 | qapi/misc.json | 4 +++- |
11 | vl.c | 5 +++++ | |
95259824 WB |
12 | 2 files changed, 8 insertions(+), 1 deletion(-) |
13 | ||
53e83913 | 14 | diff --git a/qapi/misc.json b/qapi/misc.json |
b855dce7 | 15 | index c98bb4b559..4a0e26720e 100644 |
53e83913 WB |
16 | --- a/qapi/misc.json |
17 | +++ b/qapi/misc.json | |
b855dce7 | 18 | @@ -2033,6 +2033,8 @@ |
95259824 | 19 | # |
a544966d | 20 | # @is-default: whether the machine is default |
95259824 | 21 | # |
a544966d | 22 | +# @is-current: whether this machine is currently used |
95259824 WB |
23 | +# |
24 | # @cpu-max: maximum number of CPUs supported by the machine type | |
25 | # (since 1.5.0) | |
26 | # | |
b855dce7 | 27 | @@ -2042,7 +2044,7 @@ |
95259824 WB |
28 | ## |
29 | { 'struct': 'MachineInfo', | |
30 | 'data': { 'name': 'str', '*alias': 'str', | |
31 | - '*is-default': 'bool', 'cpu-max': 'int', | |
32 | + '*is-default': 'bool', '*is-current': 'bool', 'cpu-max': 'int', | |
33 | 'hotpluggable-cpus': 'bool'} } | |
34 | ||
35 | ## | |
36 | diff --git a/vl.c b/vl.c | |
b8d43c59 | 37 | index c3dee09c9b..98efed1a79 100644 |
95259824 WB |
38 | --- a/vl.c |
39 | +++ b/vl.c | |
b855dce7 | 40 | @@ -1531,6 +1531,11 @@ MachineInfoList *qmp_query_machines(Error **errp) |
95259824 | 41 | info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus; |
a544966d | 42 | info->hotpluggable_cpus = mc->has_hotpluggable_cpus; |
95259824 WB |
43 | |
44 | + if (strcmp(mc->name, MACHINE_GET_CLASS(current_machine)->name) == 0) { | |
45 | + info->has_is_current = true; | |
46 | + info->is_current = true; | |
47 | + } | |
48 | + | |
49 | entry = g_malloc0(sizeof(*entry)); | |
50 | entry->value = info; | |
51 | entry->next = mach_list; |