]>
Commit | Line | Data |
---|---|---|
6fb04df7 | 1 | From 7ec55edfacec8698e6fde6e8be0163e57526be2b Mon Sep 17 00:00:00 2001 |
ca0fe5f5 WB |
2 | From: Wolfgang Bumiller <w.bumiller@proxmox.com> |
3 | Date: Wed, 9 Dec 2015 14:31:18 +0100 | |
6fb04df7 | 4 | Subject: [PATCH 08/55] qapi: modify query machines |
ca0fe5f5 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 | |
6fb04df7 | 13 | index 639f7b6..0e97da1 100644 |
ca0fe5f5 WB |
14 | --- a/qapi-schema.json |
15 | +++ b/qapi-schema.json | |
6fb04df7 | 16 | @@ -2941,6 +2941,8 @@ |
ca0fe5f5 WB |
17 | # |
18 | # @default: #optional whether the machine is default | |
19 | # | |
20 | +# @current: #optional whether this machine is currently used | |
21 | +# | |
22 | # @cpu-max: maximum number of CPUs supported by the machine type | |
23 | # (since 1.5.0) | |
24 | # | |
6fb04df7 | 25 | @@ -2948,7 +2950,7 @@ |
ca0fe5f5 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 | ||
32 | ## | |
33 | # @query-machines: | |
34 | diff --git a/vl.c b/vl.c | |
6fb04df7 | 35 | index 5db5dc2..feeb2c4 100644 |
ca0fe5f5 WB |
36 | --- a/vl.c |
37 | +++ b/vl.c | |
6fb04df7 | 38 | @@ -1538,6 +1538,11 @@ MachineInfoList *qmp_query_machines(Error **errp) |
ca0fe5f5 WB |
39 | info->name = g_strdup(mc->name); |
40 | info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus; | |
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 | -- | |
51 | 2.1.4 | |
52 |