mirror of
				https://git.proxmox.com/git/pve-qemu
				synced 2025-11-04 06:45:43 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			53 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
From a761848c2ded6eb644c0e0e5d9184f54db59828a Mon Sep 17 00:00:00 2001
 | 
						|
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
 | 
						|
Date: Wed, 9 Dec 2015 14:31:18 +0100
 | 
						|
Subject: [PATCH 07/28] qapi: modify query machines
 | 
						|
 | 
						|
provide '*is-current' in MachineInfo struct
 | 
						|
---
 | 
						|
 qapi-schema.json | 4 +++-
 | 
						|
 vl.c             | 5 +++++
 | 
						|
 2 files changed, 8 insertions(+), 1 deletion(-)
 | 
						|
 | 
						|
diff --git a/qapi-schema.json b/qapi-schema.json
 | 
						|
index f38b85bf6a..51e150c6c1 100644
 | 
						|
--- a/qapi-schema.json
 | 
						|
+++ b/qapi-schema.json
 | 
						|
@@ -4242,6 +4242,8 @@
 | 
						|
 #
 | 
						|
 # @is-default: whether the machine is default
 | 
						|
 #
 | 
						|
+# @is-current: whether this machine is currently used
 | 
						|
+#
 | 
						|
 # @cpu-max: maximum number of CPUs supported by the machine type
 | 
						|
 #           (since 1.5.0)
 | 
						|
 #
 | 
						|
@@ -4251,7 +4253,7 @@
 | 
						|
 ##
 | 
						|
 { 'struct': 'MachineInfo',
 | 
						|
   'data': { 'name': 'str', '*alias': 'str',
 | 
						|
-            '*is-default': 'bool', 'cpu-max': 'int',
 | 
						|
+            '*is-default': 'bool', '*is-current': 'bool', 'cpu-max': 'int',
 | 
						|
             'hotpluggable-cpus': 'bool'} }
 | 
						|
 
 | 
						|
 ##
 | 
						|
diff --git a/vl.c b/vl.c
 | 
						|
index 0b4ed5241c..868c4893df 100644
 | 
						|
--- a/vl.c
 | 
						|
+++ b/vl.c
 | 
						|
@@ -1518,6 +1518,11 @@ MachineInfoList *qmp_query_machines(Error **errp)
 | 
						|
         info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus;
 | 
						|
         info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
 | 
						|
 
 | 
						|
+        if (strcmp(mc->name, MACHINE_GET_CLASS(current_machine)->name) == 0) {
 | 
						|
+            info->has_is_current = true;
 | 
						|
+            info->is_current = true;
 | 
						|
+        }
 | 
						|
+
 | 
						|
         entry = g_malloc0(sizeof(*entry));
 | 
						|
         entry->value = info;
 | 
						|
         entry->next = mach_list;
 | 
						|
-- 
 | 
						|
2.11.0
 | 
						|
 |