]>
Commit | Line | Data |
---|---|---|
ddbcf45e | 1 | From ba17137d9645c421717b20aef09fed3945dc6d14 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 | |
67af0fa4 | 4 | Subject: [PATCH 07/28] qapi: modify query machines |
95259824 WB |
5 | |
6 | provide '*is-current' in MachineInfo struct | |
7 | --- | |
8 | qapi-schema.json | 4 +++- | |
9 | vl.c | 5 +++++ | |
10 | 2 files changed, 8 insertions(+), 1 deletion(-) | |
11 | ||
12 | diff --git a/qapi-schema.json b/qapi-schema.json | |
45169293 | 13 | index f38b85bf6a..51e150c6c1 100644 |
95259824 WB |
14 | --- a/qapi-schema.json |
15 | +++ b/qapi-schema.json | |
45169293 | 16 | @@ -4242,6 +4242,8 @@ |
95259824 | 17 | # |
a544966d | 18 | # @is-default: whether the machine is default |
95259824 | 19 | # |
a544966d | 20 | +# @is-current: whether this machine is currently used |
95259824 WB |
21 | +# |
22 | # @cpu-max: maximum number of CPUs supported by the machine type | |
23 | # (since 1.5.0) | |
24 | # | |
45169293 | 25 | @@ -4251,7 +4253,7 @@ |
95259824 WB |
26 | ## |
27 | { 'struct': 'MachineInfo', | |
28 | 'data': { 'name': 'str', '*alias': 'str', | |
29 | - '*is-default': 'bool', 'cpu-max': 'int', | |
30 | + '*is-default': 'bool', '*is-current': 'bool', 'cpu-max': 'int', | |
31 | 'hotpluggable-cpus': 'bool'} } | |
32 | ||
33 | ## | |
34 | diff --git a/vl.c b/vl.c | |
ddbcf45e | 35 | index b719cc432e..46de1b9087 100644 |
95259824 WB |
36 | --- a/vl.c |
37 | +++ b/vl.c | |
a544966d | 38 | @@ -1518,6 +1518,11 @@ MachineInfoList *qmp_query_machines(Error **errp) |
95259824 | 39 | info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus; |
a544966d | 40 | info->hotpluggable_cpus = mc->has_hotpluggable_cpus; |
95259824 WB |
41 | |
42 | + if (strcmp(mc->name, MACHINE_GET_CLASS(current_machine)->name) == 0) { | |
43 | + info->has_is_current = true; | |
44 | + info->is_current = true; | |
45 | + } | |
46 | + | |
47 | entry = g_malloc0(sizeof(*entry)); | |
48 | entry->value = info; | |
49 | entry->next = mach_list; | |
50 | -- | |
45169293 | 51 | 2.11.0 |
95259824 | 52 |