[pve-devel] [PATCH 3/3] kvm: introduce qemuver and set machine flag based on qemuver

Dietmar Maurer dietmar at proxmox.com
Wed May 29 06:45:01 CEST 2013


> > > But the qemu version might have change since you started the VM. So
> > > if you query the version on doing the snapshot it might not be the
> > > version actually running. This also affects migrations.
> >
> > So you need to query the 'machine' type qemu is actually using (not a
> > 'version')?
> 
> I only found a way to query the available machine types (including default
> type):
> 
>   my $cmd = { execute => 'query-machines', arguments => {} };
>   my $res = PVE::QemuServer::vm_qmp_command($vmid, $cmd);
> 
> But I this also changes on updates.
> 
> Maybe we can change that to include the currently used machine type?
> 

So maybe the following would help?

Index: new/qapi-schema.json
===================================================================
--- new.orig/qapi-schema.json	2013-05-29 06:32:28.000000000 +0200
+++ new/qapi-schema.json	2013-05-29 06:35:27.000000000 +0200
@@ -2947,11 +2947,13 @@
 #
 # @default: #optional whether the machine is default
 #
+# @current: #optional whether this machine is currently used
+#
 # Since: 1.2.0
 ##
 { 'type': 'MachineInfo',
   'data': { 'name': 'str', '*alias': 'str',
-            '*is-default': 'bool' } }
+            '*is-default': 'bool', '*is-current': 'bool', } }
 
 ##
 # @query-machines:
Index: new/vl.c
===================================================================
--- new.orig/vl.c	2013-05-29 06:32:28.000000000 +0200
+++ new/vl.c	2013-05-29 06:39:13.000000000 +0200
@@ -1579,6 +1579,11 @@
 
         info->name = g_strdup(m->name);
 
+        if (strcmp(m->name, 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;





More information about the pve-devel mailing list